Scripting : cleanup, add poweruptype enum

This commit is contained in:
Marianne Gagnon 2015-05-31 18:39:40 -04:00
parent 501dd14bb6
commit b3d97241d7
4 changed files with 22 additions and 21 deletions

View File

@ -22,8 +22,10 @@
#include "karts/kart.hpp"
#include "modes/world.hpp"
#include "scriptengine/script_challenges.hpp"
#include "scriptengine/script_kart.hpp"
#include "scriptengine/script_engine.hpp"
#include "scriptengine/script_gui.hpp"
#include "scriptengine/script_physics.hpp"
#include "scriptengine/script_track.hpp"
#include "scriptengine/script_utils.hpp"
#include "scriptengine/scriptstdstring.hpp"
@ -353,6 +355,7 @@ namespace Scripting
Scripting::Track::registerScriptFunctions(m_engine);
Scripting::Challenges::registerScriptFunctions(m_engine);
Scripting::Kart::registerScriptFunctions(m_engine);
Scripting::Kart::registerScriptEnums(m_engine);
Scripting::Physics::registerScriptFunctions(m_engine);
Scripting::Utils::registerScriptFunctions(m_engine);
Scripting::GUI::registerScriptFunctions(m_engine);

View File

@ -27,24 +27,6 @@ class TrackObjectPresentation;
namespace Scripting
{
namespace Physics
{
void registerScriptFunctions(asIScriptEngine *engine);
}
namespace Kart
{
void registerScriptFunctions(asIScriptEngine *engine);
}
namespace Track
{
void registerScriptFunctions(asIScriptEngine *engine);
void registerScriptEnums(asIScriptEngine *engine);
}
class ScriptEngine
{
public:

View File

@ -123,6 +123,23 @@ namespace Scripting
//r = engine->RegisterGlobalFunction("void jumpTo(int id, float x, float y)", asFUNCTION(jumpTo), asCALL_GENERIC); assert(r >= 0);
r = engine->RegisterGlobalFunction("Vec3 getLocation(int id)", asFUNCTION(getLocation), asCALL_CDECL); assert(r >= 0);
}
void registerScriptEnums(asIScriptEngine *engine)
{
// TODO: document enum in doxygen-generated scripting docs
engine->SetDefaultNamespace("Kart");
engine->RegisterEnum("PowerupType");
engine->RegisterEnumValue("PowerupType", "ANVIL", PowerupManager::PowerupType::POWERUP_ANVIL);
engine->RegisterEnumValue("PowerupType", "BOWLING", PowerupManager::PowerupType::POWERUP_BOWLING);
engine->RegisterEnumValue("PowerupType", "BUBBLEGUM", PowerupManager::PowerupType::POWERUP_BUBBLEGUM);
engine->RegisterEnumValue("PowerupType", "CAKE", PowerupManager::PowerupType::POWERUP_CAKE);
engine->RegisterEnumValue("PowerupType", "PARACHUTE", PowerupManager::PowerupType::POWERUP_PARACHUTE);
engine->RegisterEnumValue("PowerupType", "PLUNGER", PowerupManager::PowerupType::POWERUP_PLUNGER);
engine->RegisterEnumValue("PowerupType", "RUBBERBALL", PowerupManager::PowerupType::POWERUP_RUBBERBALL);
engine->RegisterEnumValue("PowerupType", "SWATTER", PowerupManager::PowerupType::POWERUP_SWATTER);
engine->RegisterEnumValue("PowerupType", "SWITCH", PowerupManager::PowerupType::POWERUP_SWITCH);
engine->RegisterEnumValue("PowerupType", "ZIPPER", PowerupManager::PowerupType::POWERUP_ZIPPER);
}
}
/** \cond DOXYGEN_IGNORE */

View File

@ -23,13 +23,12 @@
namespace Scripting
{
namespace Kart
{
void registerScriptFunctions(asIScriptEngine *engine);
void registerScriptEnums(asIScriptEngine *engine);
}
}
#endif