This commit is contained in:
Alex 2013-08-07 15:40:57 -04:00
parent a0931b01fe
commit b9579e085f
5 changed files with 128 additions and 129 deletions

View file

@ -397,8 +397,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings)
mTranslationDataStorage.loadTranslationData(mFileCollections, mMaster[i]); mTranslationDataStorage.loadTranslationData(mFileCollections, mMaster[i]);
// Create window manager - this manages all the MW-specific GUI windows // Create window manager - this manages all the MW-specific GUI windows
// before compiler reorganization the following line was "MWScript::registerExtensions (mExtensions);" Compiler::registerExtensions (mExtensions);
Compiler::registerExtensions (mExtensions, false);
mEnvironment.setWindowManager (new MWGui::WindowManager( mEnvironment.setWindowManager (new MWGui::WindowManager(
mExtensions, mFpsLevel, mOgre, mCfgMgr.getLogPath().string() + std::string("/"), mExtensions, mFpsLevel, mOgre, mCfgMgr.getLogPath().string() + std::string("/"),

View file

@ -5,9 +5,9 @@
namespace Compiler namespace Compiler
{ {
void registerExtensions (Extensions& extensions, bool consoleOnly) void registerExtensions (Extensions& extensions, bool consoleOnly)
{ {
Ai::registerExtensions (extensions); Ai::registerExtensions (extensions);
Animation::registerExtensions (extensions); Animation::registerExtensions (extensions);
Cell::registerExtensions (extensions); Cell::registerExtensions (extensions);
Container::registerExtensions (extensions); Container::registerExtensions (extensions);
@ -28,8 +28,8 @@ namespace Compiler
} }
namespace Ai namespace Ai
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction ("aiactivate", "c/l", opcodeAIActivate, extensions.registerInstruction ("aiactivate", "c/l", opcodeAIActivate,
opcodeAIActivateExplicit); opcodeAIActivateExplicit);
@ -64,21 +64,21 @@ namespace Compiler
extensions.registerFunction ("getflee", 'l', "", opcodeGetFlee, opcodeGetFleeExplicit); extensions.registerFunction ("getflee", 'l', "", opcodeGetFlee, opcodeGetFleeExplicit);
extensions.registerFunction ("getalarm", 'l', "", opcodeGetAlarm, opcodeGetAlarmExplicit); extensions.registerFunction ("getalarm", 'l', "", opcodeGetAlarm, opcodeGetAlarmExplicit);
} }
} }
namespace Animation namespace Animation
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction ("skipanim", "", opcodeSkipAnim, opcodeSkipAnimExplicit); extensions.registerInstruction ("skipanim", "", opcodeSkipAnim, opcodeSkipAnimExplicit);
extensions.registerInstruction ("playgroup", "c/l", opcodePlayAnim, opcodePlayAnimExplicit); extensions.registerInstruction ("playgroup", "c/l", opcodePlayAnim, opcodePlayAnimExplicit);
extensions.registerInstruction ("loopgroup", "cl/l", opcodeLoopAnim, opcodeLoopAnimExplicit); extensions.registerInstruction ("loopgroup", "cl/l", opcodeLoopAnim, opcodeLoopAnimExplicit);
} }
} }
namespace Cell namespace Cell
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerFunction ("cellchanged", 'l', "", opcodeCellChanged); extensions.registerFunction ("cellchanged", 'l', "", opcodeCellChanged);
extensions.registerInstruction ("coc", "S", opcodeCOC); extensions.registerInstruction ("coc", "S", opcodeCOC);
@ -91,19 +91,19 @@ namespace Compiler
extensions.registerFunction ("getpccell", 'l', "c", opcodeGetPCCell); extensions.registerFunction ("getpccell", 'l', "c", opcodeGetPCCell);
extensions.registerFunction ("getwaterlevel", 'f', "", opcodeGetWaterLevel); extensions.registerFunction ("getwaterlevel", 'f', "", opcodeGetWaterLevel);
} }
} }
namespace Console namespace Console
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
} }
} }
namespace Container namespace Container
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction ("additem", "cl", opcodeAddItem, opcodeAddItemExplicit); extensions.registerInstruction ("additem", "cl", opcodeAddItem, opcodeAddItemExplicit);
extensions.registerFunction ("getitemcount", 'l', "c", opcodeGetItemCount, extensions.registerFunction ("getitemcount", 'l', "c", opcodeGetItemCount,
@ -116,11 +116,11 @@ namespace Compiler
extensions.registerFunction ("hassoulgem", 'l', "c", opcodeHasSoulGem, opcodeHasSoulGemExplicit); extensions.registerFunction ("hassoulgem", 'l', "c", opcodeHasSoulGem, opcodeHasSoulGemExplicit);
extensions.registerFunction ("getweapontype", 'l', "", opcodeGetWeaponType, opcodeGetWeaponTypeExplicit); extensions.registerFunction ("getweapontype", 'l', "", opcodeGetWeaponType, opcodeGetWeaponTypeExplicit);
} }
} }
namespace Control namespace Control
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
std::string enable ("enable"); std::string enable ("enable");
std::string disable ("disable"); std::string disable ("disable");
@ -149,11 +149,11 @@ namespace Compiler
extensions.registerFunction ("getforcerun", 'l', "", opcodeGetForceRun, opcodeGetForceRunExplicit); extensions.registerFunction ("getforcerun", 'l', "", opcodeGetForceRun, opcodeGetForceRunExplicit);
extensions.registerFunction ("getforcesneak", 'l', "", opcodeGetForceSneak, opcodeGetForceSneakExplicit); extensions.registerFunction ("getforcesneak", 'l', "", opcodeGetForceSneak, opcodeGetForceSneakExplicit);
} }
} }
namespace Dialogue namespace Dialogue
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction ("journal", "cl", opcodeJournal); extensions.registerInstruction ("journal", "cl", opcodeJournal);
extensions.registerInstruction ("setjournalindex", "cl", opcodeSetJournalIndex); extensions.registerInstruction ("setjournalindex", "cl", opcodeSetJournalIndex);
@ -173,18 +173,18 @@ namespace Compiler
extensions.registerFunction("samefaction", 'l', "", opcodeSameFaction, extensions.registerFunction("samefaction", 'l', "", opcodeSameFaction,
opcodeSameFactionExplicit); opcodeSameFactionExplicit);
} }
} }
namespace Gui namespace Gui
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction ("enablebirthmenu", "", opcodeEnableBirthMenu); extensions.registerInstruction ("enablebirthmenu", "", opcodeEnableBirthMenu);
extensions.registerInstruction ("enableclassmenu", "", opcodeEnableClassMenu); extensions.registerInstruction ("enableclassmenu", "", opcodeEnableClassMenu);
extensions.registerInstruction ("enablenamemenu", "", opcodeEnableNameMenu); extensions.registerInstruction ("enablenamemenu", "", opcodeEnableNameMenu);
extensions.registerInstruction ("enableracemenu", "", opcodeEnableRaceMenu); extensions.registerInstruction ("enableracemenu", "", opcodeEnableRaceMenu);
extensions.registerInstruction ("enablestatreviewmenu", "", extensions.registerInstruction ("enablestatreviewmenu", "",
opcodeEnableStatsReviewMenu); opcodeEnableStatsReviewMenu);
extensions.registerInstruction ("enableinventorymenu", "", opcodeEnableInventoryMenu); extensions.registerInstruction ("enableinventorymenu", "", opcodeEnableInventoryMenu);
extensions.registerInstruction ("enablemagicmenu", "", opcodeEnableMagicMenu); extensions.registerInstruction ("enablemagicmenu", "", opcodeEnableMagicMenu);
@ -207,11 +207,11 @@ namespace Compiler
extensions.registerInstruction ("showmap", "S", opcodeShowMap); extensions.registerInstruction ("showmap", "S", opcodeShowMap);
extensions.registerInstruction ("fillmap", "", opcodeFillMap); extensions.registerInstruction ("fillmap", "", opcodeFillMap);
} }
} }
namespace Misc namespace Misc
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerFunction ("xbox", 'l', "", opcodeXBox); extensions.registerFunction ("xbox", 'l', "", opcodeXBox);
extensions.registerFunction ("onactivate", 'l', "", opcodeOnActivate); extensions.registerFunction ("onactivate", 'l', "", opcodeOnActivate);
@ -257,11 +257,11 @@ namespace Compiler
extensions.registerInstruction ("disableteleporting", "", opcodeDisableTeleporting); extensions.registerInstruction ("disableteleporting", "", opcodeDisableTeleporting);
extensions.registerInstruction ("enableteleporting", "", opcodeEnableTeleporting); extensions.registerInstruction ("enableteleporting", "", opcodeEnableTeleporting);
} }
} }
namespace Sky namespace Sky
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction ("togglesky", "", opcodeToggleSky); extensions.registerInstruction ("togglesky", "", opcodeToggleSky);
extensions.registerInstruction ("ts", "", opcodeToggleSky); extensions.registerInstruction ("ts", "", opcodeToggleSky);
@ -273,11 +273,11 @@ namespace Compiler
extensions.registerFunction ("getcurrentweather", 'l', "", opcodeGetCurrentWeather); extensions.registerFunction ("getcurrentweather", 'l', "", opcodeGetCurrentWeather);
extensions.registerInstruction ("modregion", "S/llllllllll", opcodeModRegion); extensions.registerInstruction ("modregion", "S/llllllllll", opcodeModRegion);
} }
} }
namespace Sound namespace Sound
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction ("say", "SS", opcodeSay, opcodeSayExplicit); extensions.registerInstruction ("say", "SS", opcodeSay, opcodeSayExplicit);
extensions.registerFunction ("saydone", 'l', "", opcodeSayDone, opcodeSayDoneExplicit); extensions.registerFunction ("saydone", 'l', "", opcodeSayDone, opcodeSayDoneExplicit);
@ -297,11 +297,11 @@ namespace Compiler
extensions.registerFunction ("getsoundplaying", 'l', "c", opcodeGetSoundPlaying, extensions.registerFunction ("getsoundplaying", 'l', "c", opcodeGetSoundPlaying,
opcodeGetSoundPlayingExplicit); opcodeGetSoundPlayingExplicit);
} }
} }
namespace Stats namespace Stats
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
static const char *attributes[numberOfAttributes] = static const char *attributes[numberOfAttributes] =
{ {
@ -419,11 +419,11 @@ namespace Compiler
extensions.registerFunction ("iswerewolf", 'l', "", opcodeIsWerewolf, opcodeIsWerewolfExplicit); extensions.registerFunction ("iswerewolf", 'l', "", opcodeIsWerewolf, opcodeIsWerewolfExplicit);
} }
} }
namespace Transformation namespace Transformation
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction("setscale","f",opcodeSetScale,opcodeSetScaleExplicit); extensions.registerInstruction("setscale","f",opcodeSetScale,opcodeSetScaleExplicit);
extensions.registerFunction("getscale",'f',"",opcodeGetScale,opcodeGetScaleExplicit); extensions.registerFunction("getscale",'f',"",opcodeGetScale,opcodeGetScaleExplicit);
@ -446,16 +446,16 @@ namespace Compiler
extensions.registerInstruction("moveworld","cf",opcodeMoveWorld,opcodeMoveWorldExplicit); extensions.registerInstruction("moveworld","cf",opcodeMoveWorld,opcodeMoveWorldExplicit);
extensions.registerFunction("getstartingangle",'f',"c",opcodeGetStartingAngle,opcodeGetStartingAngleExplicit); extensions.registerFunction("getstartingangle",'f',"c",opcodeGetStartingAngle,opcodeGetStartingAngleExplicit);
} }
} }
namespace User namespace User
{ {
void registerExtensions (Extensions& extensions) void registerExtensions (Extensions& extensions)
{ {
extensions.registerInstruction ("user1", "", opcodeUser1); extensions.registerInstruction ("user1", "", opcodeUser1);
extensions.registerInstruction ("user2", "", opcodeUser2); extensions.registerInstruction ("user2", "", opcodeUser2);
extensions.registerInstruction ("user3", "", opcodeUser3, opcodeUser3); extensions.registerInstruction ("user3", "", opcodeUser3, opcodeUser3);
extensions.registerInstruction ("user4", "", opcodeUser4, opcodeUser4); extensions.registerInstruction ("user4", "", opcodeUser4, opcodeUser4);
} }
} }
} }

View file

@ -3,79 +3,79 @@
namespace Compiler namespace Compiler
{ {
class Extensions; class Extensions;
void registerExtensions (Extensions& extensions, bool consoleOnly); void registerExtensions (Extensions& extensions, bool consoleOnly = false);
namespace Ai namespace Ai
{ {
void registerExtensions (Extensions& extensions);
}
namespace Animation
{
void registerExtensions (Extensions& extensions);
}
namespace Cell
{
void registerExtensions (Extensions& extensions);
}
namespace Console
{
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Container namespace Animation
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Control namespace Cell
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Dialogue namespace Console
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Gui namespace Container
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Misc namespace Control
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Sky namespace Dialogue
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Sound namespace Gui
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Stats namespace Misc
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Transformation namespace Sky
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace User namespace Sound
{ {
void registerExtensions (Extensions& extensions); void registerExtensions (Extensions& extensions);
} }
namespace Stats
{
void registerExtensions (Extensions& extensions);
}
namespace Transformation
{
void registerExtensions (Extensions& extensions);
}
namespace User
{
void registerExtensions (Extensions& extensions);
}
} }
#endif #endif

View file

@ -2,12 +2,12 @@
namespace Compiler namespace Compiler
{ {
namespace Control namespace Control
{ {
const char *controls[numberOfControls] = const char *controls[numberOfControls] =
{ {
"playercontrols", "playerfighting", "playerjumping", "playerlooking", "playermagic", "playercontrols", "playerfighting", "playerjumping", "playerlooking", "playermagic",
"playerviewswitch", "vanitymode" "playerviewswitch", "vanitymode"
}; };
} }
} }

View file

@ -53,7 +53,7 @@ namespace Compiler
namespace Animation namespace Animation
{ {
const int opcodeSkipAnim = 0x2000138; const int opcodeSkipAnim = 0x2000138;
const int opcodeSkipAnimExplicit = 0x2000139; const int opcodeSkipAnimExplicit = 0x2000139;
const int opcodePlayAnim = 0x20006; const int opcodePlayAnim = 0x20006;
const int opcodePlayAnimExplicit = 0x20007; const int opcodePlayAnimExplicit = 0x20007;
@ -63,7 +63,7 @@ namespace Compiler
namespace Cell namespace Cell
{ {
const int opcodeCellChanged = 0x2000000; const int opcodeCellChanged = 0x2000000;
const int opcodeCOC = 0x2000026; const int opcodeCOC = 0x2000026;
const int opcodeCOE = 0x200008e; const int opcodeCOE = 0x200008e;
const int opcodeGetInterior = 0x2000131; const int opcodeGetInterior = 0x2000131;
@ -80,7 +80,7 @@ namespace Compiler
namespace Container namespace Container
{ {
const int opcodeAddItem = 0x2000076; const int opcodeAddItem = 0x2000076;
const int opcodeAddItemExplicit = 0x2000077; const int opcodeAddItemExplicit = 0x2000077;
const int opcodeGetItemCount = 0x2000078; const int opcodeGetItemCount = 0x2000078;
const int opcodeGetItemCountExplicit = 0x2000079; const int opcodeGetItemCountExplicit = 0x2000079;
@ -100,11 +100,11 @@ namespace Compiler
namespace Control namespace Control
{ {
const int numberOfControls = 7; const int numberOfControls = 7;
extern const char *controls[numberOfControls]; extern const char *controls[numberOfControls];
const int opcodeEnable = 0x200007e; const int opcodeEnable = 0x200007e;
const int opcodeDisable = 0x2000085; const int opcodeDisable = 0x2000085;
const int opcodeToggleCollision = 0x2000130; const int opcodeToggleCollision = 0x2000130;
const int opcodeClearForceRun = 0x2000154; const int opcodeClearForceRun = 0x2000154;
@ -126,7 +126,7 @@ namespace Compiler
namespace Dialogue namespace Dialogue
{ {
const int opcodeJournal = 0x2000133; const int opcodeJournal = 0x2000133;
const int opcodeSetJournalIndex = 0x2000134; const int opcodeSetJournalIndex = 0x2000134;
const int opcodeGetJournalIndex = 0x2000135; const int opcodeGetJournalIndex = 0x2000135;
const int opcodeAddTopic = 0x200013a; const int opcodeAddTopic = 0x200013a;
@ -146,7 +146,7 @@ namespace Compiler
namespace Gui namespace Gui
{ {
const int opcodeEnableBirthMenu = 0x200000e; const int opcodeEnableBirthMenu = 0x200000e;
const int opcodeEnableClassMenu = 0x200000f; const int opcodeEnableClassMenu = 0x200000f;
const int opcodeEnableNameMenu = 0x2000010; const int opcodeEnableNameMenu = 0x2000010;
const int opcodeEnableRaceMenu = 0x2000011; const int opcodeEnableRaceMenu = 0x2000011;
@ -166,7 +166,7 @@ namespace Compiler
namespace Misc namespace Misc
{ {
const int opcodeXBox = 0x200000c; const int opcodeXBox = 0x200000c;
const int opcodeOnActivate = 0x200000d; const int opcodeOnActivate = 0x200000d;
const int opcodeActivate = 0x2000075; const int opcodeActivate = 0x2000075;
const int opcodeLock = 0x20004; const int opcodeLock = 0x20004;
@ -223,7 +223,7 @@ namespace Compiler
namespace Sky namespace Sky
{ {
const int opcodeToggleSky = 0x2000021; const int opcodeToggleSky = 0x2000021;
const int opcodeTurnMoonWhite = 0x2000022; const int opcodeTurnMoonWhite = 0x2000022;
const int opcodeTurnMoonRed = 0x2000023; const int opcodeTurnMoonRed = 0x2000023;
const int opcodeGetMasserPhase = 0x2000024; const int opcodeGetMasserPhase = 0x2000024;
@ -235,7 +235,7 @@ namespace Compiler
namespace Sound namespace Sound
{ {
const int opcodeSay = 0x2000001; const int opcodeSay = 0x2000001;
const int opcodeSayDone = 0x2000002; const int opcodeSayDone = 0x2000002;
const int opcodeStreamMusic = 0x2000003; const int opcodeStreamMusic = 0x2000003;
const int opcodePlaySound = 0x2000004; const int opcodePlaySound = 0x2000004;
@ -259,11 +259,11 @@ namespace Compiler
namespace Stats namespace Stats
{ {
const int numberOfAttributes = 8; const int numberOfAttributes = 8;
const int numberOfDynamics = 3; const int numberOfDynamics = 3;
const int numberOfSkills = 27; const int numberOfSkills = 27;
const int opcodeGetAttribute = 0x2000027; const int opcodeGetAttribute = 0x2000027;
const int opcodeGetAttributeExplicit = 0x200002f; const int opcodeGetAttributeExplicit = 0x200002f;
const int opcodeSetAttribute = 0x2000037; const int opcodeSetAttribute = 0x2000037;
const int opcodeSetAttributeExplicit = 0x200003f; const int opcodeSetAttributeExplicit = 0x200003f;
@ -353,7 +353,7 @@ namespace Compiler
namespace Transformation namespace Transformation
{ {
const int opcodeSetScale = 0x2000164; const int opcodeSetScale = 0x2000164;
const int opcodeSetScaleExplicit = 0x2000165; const int opcodeSetScaleExplicit = 0x2000165;
const int opcodeSetAngle = 0x2000166; const int opcodeSetAngle = 0x2000166;
const int opcodeSetAngleExplicit = 0x2000167; const int opcodeSetAngleExplicit = 0x2000167;
@ -395,7 +395,7 @@ namespace Compiler
namespace User namespace User
{ {
const int opcodeUser1 = 0x200016c; const int opcodeUser1 = 0x200016c;
const int opcodeUser2 = 0x200016d; const int opcodeUser2 = 0x200016d;
const int opcodeUser3 = 0x200016e; const int opcodeUser3 = 0x200016e;
const int opcodeUser3Explicit = 0x200016f; const int opcodeUser3Explicit = 0x200016f;