From b9579e085fe7d66d584a88fd00c541e572817b69 Mon Sep 17 00:00:00 2001 From: Alex Date: Wed, 7 Aug 2013 15:40:57 -0400 Subject: [PATCH] cleanup --- apps/openmw/engine.cpp | 3 +- components/compiler/extensions0.cpp | 116 ++++++++++++++-------------- components/compiler/extensions0.hpp | 100 ++++++++++++------------ components/compiler/opcodes.cpp | 8 +- components/compiler/opcodes.hpp | 30 +++---- 5 files changed, 128 insertions(+), 129 deletions(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 7441875635..9516da5ae0 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -397,8 +397,7 @@ void OMW::Engine::prepareEngine (Settings::Manager & settings) mTranslationDataStorage.loadTranslationData(mFileCollections, mMaster[i]); // Create window manager - this manages all the MW-specific GUI windows - // before compiler reorganization the following line was "MWScript::registerExtensions (mExtensions);" - Compiler::registerExtensions (mExtensions, false); + Compiler::registerExtensions (mExtensions); mEnvironment.setWindowManager (new MWGui::WindowManager( mExtensions, mFpsLevel, mOgre, mCfgMgr.getLogPath().string() + std::string("/"), diff --git a/components/compiler/extensions0.cpp b/components/compiler/extensions0.cpp index 470bc60809..5eca8ed7a2 100644 --- a/components/compiler/extensions0.cpp +++ b/components/compiler/extensions0.cpp @@ -5,9 +5,9 @@ namespace Compiler { - void registerExtensions (Extensions& extensions, bool consoleOnly) + void registerExtensions (Extensions& extensions, bool consoleOnly) { - Ai::registerExtensions (extensions); + Ai::registerExtensions (extensions); Animation::registerExtensions (extensions); Cell::registerExtensions (extensions); Container::registerExtensions (extensions); @@ -28,8 +28,8 @@ namespace Compiler } namespace Ai - { - void registerExtensions (Extensions& extensions) + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction ("aiactivate", "c/l", opcodeAIActivate, opcodeAIActivateExplicit); @@ -64,21 +64,21 @@ namespace Compiler extensions.registerFunction ("getflee", 'l', "", opcodeGetFlee, opcodeGetFleeExplicit); extensions.registerFunction ("getalarm", 'l', "", opcodeGetAlarm, opcodeGetAlarmExplicit); } - } + } - namespace Animation - { - void registerExtensions (Extensions& extensions) + namespace Animation + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction ("skipanim", "", opcodeSkipAnim, opcodeSkipAnimExplicit); extensions.registerInstruction ("playgroup", "c/l", opcodePlayAnim, opcodePlayAnimExplicit); extensions.registerInstruction ("loopgroup", "cl/l", opcodeLoopAnim, opcodeLoopAnimExplicit); } - } + } - namespace Cell - { - void registerExtensions (Extensions& extensions) + namespace Cell + { + void registerExtensions (Extensions& extensions) { extensions.registerFunction ("cellchanged", 'l', "", opcodeCellChanged); extensions.registerInstruction ("coc", "S", opcodeCOC); @@ -91,19 +91,19 @@ namespace Compiler extensions.registerFunction ("getpccell", 'l', "c", opcodeGetPCCell); extensions.registerFunction ("getwaterlevel", 'f', "", opcodeGetWaterLevel); } - } + } - namespace Console - { - void registerExtensions (Extensions& extensions) + namespace Console + { + void registerExtensions (Extensions& extensions) { } - } + } - namespace Container - { - void registerExtensions (Extensions& extensions) + namespace Container + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction ("additem", "cl", opcodeAddItem, opcodeAddItemExplicit); extensions.registerFunction ("getitemcount", 'l', "c", opcodeGetItemCount, @@ -116,11 +116,11 @@ namespace Compiler extensions.registerFunction ("hassoulgem", 'l', "c", opcodeHasSoulGem, opcodeHasSoulGemExplicit); extensions.registerFunction ("getweapontype", 'l', "", opcodeGetWeaponType, opcodeGetWeaponTypeExplicit); } - } + } - namespace Control - { - void registerExtensions (Extensions& extensions) + namespace Control + { + void registerExtensions (Extensions& extensions) { std::string enable ("enable"); std::string disable ("disable"); @@ -149,11 +149,11 @@ namespace Compiler extensions.registerFunction ("getforcerun", 'l', "", opcodeGetForceRun, opcodeGetForceRunExplicit); extensions.registerFunction ("getforcesneak", 'l', "", opcodeGetForceSneak, opcodeGetForceSneakExplicit); } - } + } - namespace Dialogue - { - void registerExtensions (Extensions& extensions) + namespace Dialogue + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction ("journal", "cl", opcodeJournal); extensions.registerInstruction ("setjournalindex", "cl", opcodeSetJournalIndex); @@ -173,18 +173,18 @@ namespace Compiler extensions.registerFunction("samefaction", 'l', "", opcodeSameFaction, opcodeSameFactionExplicit); } - } + } - namespace Gui - { - void registerExtensions (Extensions& extensions) + namespace Gui + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction ("enablebirthmenu", "", opcodeEnableBirthMenu); extensions.registerInstruction ("enableclassmenu", "", opcodeEnableClassMenu); extensions.registerInstruction ("enablenamemenu", "", opcodeEnableNameMenu); extensions.registerInstruction ("enableracemenu", "", opcodeEnableRaceMenu); extensions.registerInstruction ("enablestatreviewmenu", "", - opcodeEnableStatsReviewMenu); + opcodeEnableStatsReviewMenu); extensions.registerInstruction ("enableinventorymenu", "", opcodeEnableInventoryMenu); extensions.registerInstruction ("enablemagicmenu", "", opcodeEnableMagicMenu); @@ -207,11 +207,11 @@ namespace Compiler extensions.registerInstruction ("showmap", "S", opcodeShowMap); extensions.registerInstruction ("fillmap", "", opcodeFillMap); } - } + } - namespace Misc - { - void registerExtensions (Extensions& extensions) + namespace Misc + { + void registerExtensions (Extensions& extensions) { extensions.registerFunction ("xbox", 'l', "", opcodeXBox); extensions.registerFunction ("onactivate", 'l', "", opcodeOnActivate); @@ -257,11 +257,11 @@ namespace Compiler extensions.registerInstruction ("disableteleporting", "", opcodeDisableTeleporting); extensions.registerInstruction ("enableteleporting", "", opcodeEnableTeleporting); } - } + } - namespace Sky - { - void registerExtensions (Extensions& extensions) + namespace Sky + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction ("togglesky", "", opcodeToggleSky); extensions.registerInstruction ("ts", "", opcodeToggleSky); @@ -273,11 +273,11 @@ namespace Compiler extensions.registerFunction ("getcurrentweather", 'l', "", opcodeGetCurrentWeather); extensions.registerInstruction ("modregion", "S/llllllllll", opcodeModRegion); } - } + } - namespace Sound - { - void registerExtensions (Extensions& extensions) + namespace Sound + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction ("say", "SS", opcodeSay, opcodeSayExplicit); extensions.registerFunction ("saydone", 'l', "", opcodeSayDone, opcodeSayDoneExplicit); @@ -297,11 +297,11 @@ namespace Compiler extensions.registerFunction ("getsoundplaying", 'l', "c", opcodeGetSoundPlaying, opcodeGetSoundPlayingExplicit); } - } + } - namespace Stats - { - void registerExtensions (Extensions& extensions) + namespace Stats + { + void registerExtensions (Extensions& extensions) { static const char *attributes[numberOfAttributes] = { @@ -419,11 +419,11 @@ namespace Compiler extensions.registerFunction ("iswerewolf", 'l', "", opcodeIsWerewolf, opcodeIsWerewolfExplicit); } - } + } - namespace Transformation - { - void registerExtensions (Extensions& extensions) + namespace Transformation + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction("setscale","f",opcodeSetScale,opcodeSetScaleExplicit); extensions.registerFunction("getscale",'f',"",opcodeGetScale,opcodeGetScaleExplicit); @@ -446,16 +446,16 @@ namespace Compiler extensions.registerInstruction("moveworld","cf",opcodeMoveWorld,opcodeMoveWorldExplicit); extensions.registerFunction("getstartingangle",'f',"c",opcodeGetStartingAngle,opcodeGetStartingAngleExplicit); } - } + } - namespace User - { - void registerExtensions (Extensions& extensions) + namespace User + { + void registerExtensions (Extensions& extensions) { extensions.registerInstruction ("user1", "", opcodeUser1); extensions.registerInstruction ("user2", "", opcodeUser2); extensions.registerInstruction ("user3", "", opcodeUser3, opcodeUser3); extensions.registerInstruction ("user4", "", opcodeUser4, opcodeUser4); } - } + } } \ No newline at end of file diff --git a/components/compiler/extensions0.hpp b/components/compiler/extensions0.hpp index a4e1f649fd..d51507711f 100644 --- a/components/compiler/extensions0.hpp +++ b/components/compiler/extensions0.hpp @@ -3,79 +3,79 @@ namespace Compiler { - class Extensions; - - void registerExtensions (Extensions& extensions, bool consoleOnly); + class Extensions; - namespace Ai - { - void registerExtensions (Extensions& extensions); - } + void registerExtensions (Extensions& extensions, bool consoleOnly = false); - namespace Animation - { - void registerExtensions (Extensions& extensions); - } - - namespace Cell - { - void registerExtensions (Extensions& extensions); - } - - namespace Console - { + namespace Ai + { void registerExtensions (Extensions& extensions); - } + } - namespace Container - { + namespace Animation + { void registerExtensions (Extensions& extensions); - } + } - namespace Control - { + namespace Cell + { void registerExtensions (Extensions& extensions); - } + } - namespace Dialogue - { + namespace Console + { void registerExtensions (Extensions& extensions); - } + } - namespace Gui - { + namespace Container + { + void registerExtensions (Extensions& extensions); + } + + namespace Control + { + void registerExtensions (Extensions& extensions); + } + + namespace Dialogue + { + void registerExtensions (Extensions& extensions); + } + + namespace Gui + { void registerExtensions (Extensions& extensions); - } + } - namespace Misc - { + namespace Misc + { void registerExtensions (Extensions& extensions); - } + } - namespace Sky - { + namespace Sky + { void registerExtensions (Extensions& extensions); - } + } - namespace Sound - { + namespace Sound + { void registerExtensions (Extensions& extensions); - } + } - namespace Stats - { + namespace Stats + { void registerExtensions (Extensions& extensions); - } + } - namespace Transformation - { + namespace Transformation + { void registerExtensions (Extensions& extensions); - } + } - namespace User - { + namespace User + { void registerExtensions (Extensions& extensions); - } + } } #endif \ No newline at end of file diff --git a/components/compiler/opcodes.cpp b/components/compiler/opcodes.cpp index 776d1209de..8617062d63 100644 --- a/components/compiler/opcodes.cpp +++ b/components/compiler/opcodes.cpp @@ -2,12 +2,12 @@ namespace Compiler { - namespace Control - { - const char *controls[numberOfControls] = + namespace Control + { + const char *controls[numberOfControls] = { "playercontrols", "playerfighting", "playerjumping", "playerlooking", "playermagic", "playerviewswitch", "vanitymode" }; - } + } } \ No newline at end of file diff --git a/components/compiler/opcodes.hpp b/components/compiler/opcodes.hpp index b9e22d37a2..a0191b0a5f 100644 --- a/components/compiler/opcodes.hpp +++ b/components/compiler/opcodes.hpp @@ -53,7 +53,7 @@ namespace Compiler namespace Animation { - const int opcodeSkipAnim = 0x2000138; + const int opcodeSkipAnim = 0x2000138; const int opcodeSkipAnimExplicit = 0x2000139; const int opcodePlayAnim = 0x20006; const int opcodePlayAnimExplicit = 0x20007; @@ -63,7 +63,7 @@ namespace Compiler namespace Cell { - const int opcodeCellChanged = 0x2000000; + const int opcodeCellChanged = 0x2000000; const int opcodeCOC = 0x2000026; const int opcodeCOE = 0x200008e; const int opcodeGetInterior = 0x2000131; @@ -80,7 +80,7 @@ namespace Compiler namespace Container { - const int opcodeAddItem = 0x2000076; + const int opcodeAddItem = 0x2000076; const int opcodeAddItemExplicit = 0x2000077; const int opcodeGetItemCount = 0x2000078; const int opcodeGetItemCountExplicit = 0x2000079; @@ -100,11 +100,11 @@ namespace Compiler 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 opcodeToggleCollision = 0x2000130; const int opcodeClearForceRun = 0x2000154; @@ -126,7 +126,7 @@ namespace Compiler namespace Dialogue { - const int opcodeJournal = 0x2000133; + const int opcodeJournal = 0x2000133; const int opcodeSetJournalIndex = 0x2000134; const int opcodeGetJournalIndex = 0x2000135; const int opcodeAddTopic = 0x200013a; @@ -146,7 +146,7 @@ namespace Compiler namespace Gui { - const int opcodeEnableBirthMenu = 0x200000e; + const int opcodeEnableBirthMenu = 0x200000e; const int opcodeEnableClassMenu = 0x200000f; const int opcodeEnableNameMenu = 0x2000010; const int opcodeEnableRaceMenu = 0x2000011; @@ -166,7 +166,7 @@ namespace Compiler namespace Misc { - const int opcodeXBox = 0x200000c; + const int opcodeXBox = 0x200000c; const int opcodeOnActivate = 0x200000d; const int opcodeActivate = 0x2000075; const int opcodeLock = 0x20004; @@ -223,7 +223,7 @@ namespace Compiler namespace Sky { - const int opcodeToggleSky = 0x2000021; + const int opcodeToggleSky = 0x2000021; const int opcodeTurnMoonWhite = 0x2000022; const int opcodeTurnMoonRed = 0x2000023; const int opcodeGetMasserPhase = 0x2000024; @@ -235,7 +235,7 @@ namespace Compiler namespace Sound { - const int opcodeSay = 0x2000001; + const int opcodeSay = 0x2000001; const int opcodeSayDone = 0x2000002; const int opcodeStreamMusic = 0x2000003; const int opcodePlaySound = 0x2000004; @@ -259,11 +259,11 @@ namespace Compiler namespace Stats { - const int numberOfAttributes = 8; + const int numberOfAttributes = 8; const int numberOfDynamics = 3; const int numberOfSkills = 27; - const int opcodeGetAttribute = 0x2000027; + const int opcodeGetAttribute = 0x2000027; const int opcodeGetAttributeExplicit = 0x200002f; const int opcodeSetAttribute = 0x2000037; const int opcodeSetAttributeExplicit = 0x200003f; @@ -353,7 +353,7 @@ namespace Compiler namespace Transformation { - const int opcodeSetScale = 0x2000164; + const int opcodeSetScale = 0x2000164; const int opcodeSetScaleExplicit = 0x2000165; const int opcodeSetAngle = 0x2000166; const int opcodeSetAngleExplicit = 0x2000167; @@ -395,7 +395,7 @@ namespace Compiler namespace User { - const int opcodeUser1 = 0x200016c; + const int opcodeUser1 = 0x200016c; const int opcodeUser2 = 0x200016d; const int opcodeUser3 = 0x200016e; const int opcodeUser3Explicit = 0x200016f;