defs.cpp

Go to the documentation of this file.
00001 
00002 //            Copyright (C) 2004-2007 by The Allacrost Project
00003 //                         All Rights Reserved
00004 //
00005 // This code is licensed under the GNU GPL version 2. It is free software
00006 // and you may modify it and/or redistribute it under the terms of this license.
00007 // See http://www.gnu.org/copyleft/gpl.html for details.
00009 
00026 #include "utils.h"
00027 #include "defs.h"
00028 
00029 #include "audio.h"
00030 #include "input.h"
00031 #include "mode_manager.h"
00032 #include "script.h"
00033 #include "system.h"
00034 #include "video.h"
00035 
00036 #include "global.h"
00037 #include "global_objects.h"
00038 #include "global_actors.h"
00039 #include "global_skills.h"
00040 
00041 #include "battle.h"
00042 #include "battle_actors.h"
00043 #include "map.h"
00044 #include "map_actions.h"
00045 #include "map_dialogue.h"
00046 #include "map_objects.h"
00047 #include "map_sprites.h"
00048 #include "map_zones.h"
00049 #include "shop.h"
00050 
00051 using namespace luabind;
00052 
00053 namespace hoa_defs {
00054 
00055 void BindEngineToLua() {
00056   // ---------- (1) Bind Engine Components
00057 
00058 
00059 
00060   // ----- Audio Engine Bindings
00061   {
00062   using namespace hoa_audio;
00063 
00064   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_audio")
00065   [
00066     class_<GameAudio>("GameAudio")
00067       .def("PlaySound", &GameAudio::PlaySound)
00068   ];
00069 
00070   } // End using audio namespaces
00071 
00072 
00073 
00074   // ----- Input Engine Bindings
00075   {
00076   using namespace hoa_input;
00077 
00078   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_input")
00079   [
00080     class_<GameInput>("GameInput")
00081   ];
00082 
00083   } // End using input namespaces
00084 
00085 
00086 
00087   // ----- Mode Manager Engine Bindings
00088   {
00089   using namespace hoa_mode_manager;
00090 
00091   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_mode_manager")
00092   [
00093     class_<GameMode>("GameMode")
00094   ];
00095 
00096   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_mode_manager")
00097   [
00098     class_<GameModeManager>("GameModeManager")
00099       .def("Push", &GameModeManager::Push, adopt(_2))
00100       .def("Pop", &GameModeManager::Pop)
00101   ];
00102 
00103   } // End using mode manager namespaces
00104 
00105 
00106 
00107   // ----- Script Engine Bindings
00108   {
00109   using namespace hoa_script;
00110 
00111   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_script")
00112   [
00113     class_<GameScript>("GameScript")
00114   ];
00115 
00116   } // End using script namespaces
00117 
00118 
00119 
00120   // ----- System Engine Bindings
00121   {
00122   using namespace hoa_system;
00123 
00124   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_system")
00125   [
00126     class_<GameSystem>("GameSystem")
00127   ];
00128 
00129   } // End using system namespaces
00130 
00131 
00132 
00133   // ----- Video Engine Bindings
00134   {
00135   using namespace hoa_video;
00136 
00137   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_video")
00138   [
00139     class_<GameVideo>("GameVideo")
00140   ];
00141 
00142   } // End using video namespaces
00143 
00144 
00145 
00146 
00147   // ---------- (2) Bind Global Components
00148   {
00149   using namespace hoa_global;
00150 
00151   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00152   [
00153     class_<GameGlobal>("GameGlobal")
00154       .def("AddCharacter", (void(GameGlobal::*)(uint32)) &GameGlobal::AddCharacter)
00155       .def("GetCharacter", &GameGlobal::GetCharacter)
00156       .def("GetDrunes", &GameGlobal::GetDrunes)
00157       .def("SetDrunes", &GameGlobal::SetDrunes)
00158       .def("AddDrunes", &GameGlobal::AddDrunes)
00159       .def("SubtractDrunes", &GameGlobal::SubtractDrunes)
00160       .def("AddToInventory", (void (GameGlobal::*)(uint32, uint32)) &GameGlobal::AddToInventory)
00161       .def("RemoveFromInventory", (void (GameGlobal::*)(uint32)) &GameGlobal::RemoveFromInventory)
00162       .def("IncrementObjectCount", &GameGlobal::IncrementObjectCount)
00163       .def("DecrementObjectCount", &GameGlobal::DecrementObjectCount)
00164 
00165       // Namespace constants
00166       .enum_("constants") [
00167         // Character type constants
00168         value("GLOBAL_CHARACTER_INVALID", GLOBAL_CHARACTER_INVALID),
00169         value("GLOBAL_CHARACTER_CLAUDIUS", GLOBAL_CHARACTER_CLAUDIUS),
00170         value("GLOBAL_CHARACTER_LAILA", GLOBAL_CHARACTER_LAILA),
00171         value("GLOBAL_CHARACTER_ALL", GLOBAL_CHARACTER_ALL),
00172         // Object type constants
00173         value("GLOBAL_OBJECT_INVALID", GLOBAL_OBJECT_INVALID),
00174         value("GLOBAL_OBJECT_ITEM", GLOBAL_OBJECT_ITEM),
00175         value("GLOBAL_OBJECT_WEAPON", GLOBAL_OBJECT_WEAPON),
00176         value("GLOBAL_OBJECT_HEAD_ARMOR", GLOBAL_OBJECT_HEAD_ARMOR),
00177         value("GLOBAL_OBJECT_TORSO_ARMOR", GLOBAL_OBJECT_TORSO_ARMOR),
00178         value("GLOBAL_OBJECT_ARM_ARMOR", GLOBAL_OBJECT_ARM_ARMOR),
00179         value("GLOBAL_OBJECT_LEG_ARMOR", GLOBAL_OBJECT_LEG_ARMOR),
00180         value("GLOBAL_OBJECT_SHARD", GLOBAL_OBJECT_SHARD),
00181         value("GLOBAL_OBJECT_KEY_ITEM", GLOBAL_OBJECT_KEY_ITEM),
00182         // Item usage constants
00183         value("GLOBAL_USE_INVALID", GLOBAL_USE_INVALID),
00184         value("GLOBAL_USE_MENU", GLOBAL_USE_MENU),
00185         value("GLOBAL_USE_BATTLE", GLOBAL_USE_BATTLE),
00186         value("GLOBAL_USE_ALL", GLOBAL_USE_ALL),
00187         // Item and skill alignment constants
00188         value("GLOBAL_POSITION_HEAD", GLOBAL_POSITION_HEAD),
00189         value("GLOBAL_POSITION_TORSO", GLOBAL_POSITION_TORSO),
00190         value("GLOBAL_POSITION_ARMS", GLOBAL_POSITION_ARMS),
00191         value("GLOBAL_POSITION_LEGS", GLOBAL_POSITION_LEGS),
00192         // Global skill types
00193         value("GLOBAL_SKILL_INVALID", GLOBAL_SKILL_INVALID),
00194         value("GLOBAL_SKILL_ATTACK", GLOBAL_SKILL_ATTACK),
00195         value("GLOBAL_SKILL_DEFEND", GLOBAL_SKILL_DEFEND),
00196         value("GLOBAL_SKILL_SUPPORT", GLOBAL_SKILL_SUPPORT),
00197         // Elemental type constants
00198         value("GLOBAL_ELEMENTAL_FIRE", GLOBAL_ELEMENTAL_FIRE),
00199         value("GLOBAL_ELEMENTAL_WATER", GLOBAL_ELEMENTAL_WATER),
00200         value("GLOBAL_ELEMENTAL_VOLT", GLOBAL_ELEMENTAL_VOLT),
00201         value("GLOBAL_ELEMENTAL_EARTH", GLOBAL_ELEMENTAL_EARTH),
00202         value("GLOBAL_ELEMENTAL_SLICING", GLOBAL_ELEMENTAL_SLICING),
00203         value("GLOBAL_ELEMENTAL_SMASHING", GLOBAL_ELEMENTAL_SMASHING),
00204         value("GLOBAL_ELEMENTAL_MAULING", GLOBAL_ELEMENTAL_MAULING),
00205         value("GLOBAL_ELEMENTAL_PIERCING", GLOBAL_ELEMENTAL_PIERCING),
00206         // Target constants
00207         value("GLOBAL_TARGET_INVALID", GLOBAL_TARGET_INVALID),
00208         value("GLOBAL_TARGET_ATTACK_POINT", GLOBAL_TARGET_ATTACK_POINT),
00209         value("GLOBAL_TARGET_ACTOR", GLOBAL_TARGET_ACTOR),
00210         value("GLOBAL_TARGET_PARTY", GLOBAL_TARGET_PARTY)
00211       ]
00212   ];
00213 
00214   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00215   [
00216     class_<GlobalAttackPoint>("GlobalAttackPoint")
00217       .def("GetName", &GlobalAttackPoint::GetName)
00218       .def("GetXPosition", &GlobalAttackPoint::GetXPosition)
00219       .def("GetYPosition", &GlobalAttackPoint::GetYPosition)
00220       .def("GetFortitudeModifier", &GlobalAttackPoint::GetFortitudeModifier)
00221       .def("GetProtectionModifier", &GlobalAttackPoint::GetProtectionModifier)
00222       .def("GetEvadeModifier", &GlobalAttackPoint::GetEvadeModifier)
00223       .def("GetActorOwner", &GlobalAttackPoint::GetActorOwner)
00224       .def("GetTotalPhysicalDefense", &GlobalAttackPoint::GetTotalPhysicalDefense)
00225       .def("GetTotalMetaphysicalDefense", &GlobalAttackPoint::GetTotalMetaphysicalDefense)
00226       .def("GetTotalEvadeRating", &GlobalAttackPoint::GetTotalEvadeRating)
00227   ];
00228 
00229   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00230   [
00231     class_<GlobalActor>("GlobalActor")
00232       .def("GetID", &GlobalActor::GetID)
00233       .def("GetName", &GlobalActor::GetName)
00234       .def("GetFilename", &GlobalActor::GetFilename)
00235       .def("GetHitPoints", &GlobalActor::GetHitPoints)
00236       .def("GetMaxHitPoints", &GlobalActor::GetMaxHitPoints)
00237       .def("GetSkillPoints", &GlobalActor::GetSkillPoints)
00238       .def("GetMaxSkillPoints", &GlobalActor::GetMaxSkillPoints)
00239       .def("GetExperienceLevel", &GlobalActor::GetExperienceLevel)
00240       .def("GetStrength", &GlobalActor::GetStrength)
00241       .def("GetVigor", &GlobalActor::GetVigor)
00242       .def("GetFortitude", &GlobalActor::GetFortitude)
00243       .def("GetProtection", &GlobalActor::GetProtection)
00244       .def("GetAgility", &GlobalActor::GetAgility)
00245       .def("GetEvade", &GlobalActor::GetEvade)
00246       .def("GetTotalPhysicalAttack", &GlobalActor::GetTotalPhysicalAttack)
00247       .def("GetTotalMetaphysicalAttack", &GlobalActor::GetTotalMetaphysicalAttack)
00248 //      .def("GetWeaponEquipped", &GlobalActor::GetWeaponEquipped)
00249 //      .def("GetArmorEquipped", (GlobalArmor* (GlobalActor::*)(uint32)) &GlobalActor::GetArmorEquipped)
00250 //      .def("GetAttackPoints", &GlobalActor::GetAttackPoints)
00251 //      .def("GetElementalAttackBonuses", &GlobalActor::GetElementalAttackBonuses)
00252 //      .def("GetStatusAttackBonuses", &GlobalActor::GetStatusAttackBonuses)
00253 //      .def("GetElementalDefenseBonuses", &GlobalActor::GetElementalDefenseBonuses)
00254 //      .def("GetStatusDefenseBonuses", &GlobalActor::GetStatusDefenseBonuses)
00255 
00256       .def("SetHitPoints", &GlobalActor::SetHitPoints)
00257       .def("SetSkillPoints", &GlobalActor::SetSkillPoints)
00258       .def("SetMaxHitPoints", &GlobalActor::SetMaxHitPoints)
00259       .def("SetMaxSkillPoints", &GlobalActor::SetMaxSkillPoints)
00260       .def("SetExperienceLevel", &GlobalActor::SetExperienceLevel)
00261       .def("SetStrength", &GlobalActor::SetStrength)
00262       .def("SetVigor", &GlobalActor::SetVigor)
00263       .def("SetFortitude", &GlobalActor::SetFortitude)
00264       .def("SetProtection", &GlobalActor::SetProtection)
00265       .def("SetAgility", &GlobalActor::SetAgility)
00266       .def("SetEvade", &GlobalActor::SetEvade)
00267 
00268       .def("IsAlive", &GlobalActor::IsAlive)
00269 //      .def("EquipWeapon", &GlobalActor::EquipWeapon)
00270 //      .def("EquipArmor", &GlobalActor::EquipArmor)
00271   ];
00272 
00273   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00274   [
00275     class_<GlobalCharacterGrowth>("GlobalCharacterGrowth")
00276       .def_readwrite("_hit_points_growth", &GlobalCharacterGrowth::_hit_points_growth)
00277       .def_readwrite("_skill_points_growth", &GlobalCharacterGrowth::_skill_points_growth)
00278       .def_readwrite("_strength_growth", &GlobalCharacterGrowth::_strength_growth)
00279       .def_readwrite("_vigor_growth", &GlobalCharacterGrowth::_vigor_growth)
00280       .def_readwrite("_fortitude_growth", &GlobalCharacterGrowth::_fortitude_growth)
00281       .def_readwrite("_protection_growth", &GlobalCharacterGrowth::_protection_growth)
00282       .def_readwrite("_agility_growth", &GlobalCharacterGrowth::_agility_growth)
00283       .def_readwrite("_evade_growth", &GlobalCharacterGrowth::_evade_growth)
00284       .def("_AddSkill", &GlobalCharacterGrowth::_AddSkill)
00285   ];
00286 
00287   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00288   [
00289     class_<GlobalCharacter, GlobalActor>("GlobalCharacter")
00290       .def("GetGrowth", &GlobalCharacter::GetGrowth)
00291   ];
00292 
00293   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00294   [
00295     class_<GlobalParty>("GlobalParty")
00296   ];
00297 
00298   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00299   [
00300     class_<GlobalEnemy, GlobalActor>("GlobalEnemy")
00301   ];
00302 
00303   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00304   [
00305     class_<GlobalObject>("GlobalObject")
00306       .def("GetID", &GlobalObject::GetID)
00307       .def("GetName", &GlobalObject::GetName)
00308       .def("GetType", &GlobalObject::GetObjectType)
00309       .def("GetCount", &GlobalObject::GetCount)
00310       .def("IncrementCount", &GlobalObject::IncrementCount)
00311       .def("DecrementCount", &GlobalObject::DecrementCount)
00312   ];
00313 
00314   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00315   [
00316     class_<GlobalItem, GlobalObject>("GlobalItem")
00317 //      .def(constructor<>(uint32, uint32))
00318   ];
00319 
00320   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00321   [
00322     class_<GlobalWeapon, GlobalObject>("GlobalWeapon")
00323       .def("GetUsableBy", &GlobalWeapon::GetUsableBy)
00324 //      .def(constructor<>(uint32, uint32))
00325   ];
00326 
00327   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00328   [
00329     class_<GlobalArmor, GlobalObject>("GlobalArmor")
00330       .def("GetUsableBy", &GlobalArmor::GetUsableBy)
00331 //      .def(constructor<>(uint32, uint32))
00332   ];
00333 
00334   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00335   [
00336     class_<GlobalStatusEffect>("GlobalStatusEffect")
00337   ];
00338 
00339   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00340   [
00341     class_<GlobalElementalEffect>("GlobalElementalEffect")
00342   ];
00343 
00344   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_global")
00345   [
00346     class_<GlobalSkill>("GlobalSkill")
00347   ];
00348 
00349   } // End using global namespaces
00350 
00351   // ---------- (3) Bind Util Functions
00352   {
00353   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_utils")
00354   [
00355     def("RandomFloat", &hoa_utils::RandomFloat)
00356   ];
00357   }
00358 
00359 
00360   // ---------- (4) Bind Game Mode Components
00361 
00362 
00363   // ----- Map Mode Bindings
00364   {
00365   using namespace hoa_map;
00366   using namespace hoa_map::private_map;
00367 
00368   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00369   [
00370     class_<MapMode, hoa_mode_manager::GameMode>("MapMode")
00371       .def(constructor<const std::string&>())
00372       .def_readwrite("_camera", &MapMode::_camera)
00373       .def("_AddGroundObject", &MapMode::_AddGroundObject, adopt(_2))
00374       .def("_AddPassObject", &MapMode::_AddPassObject, adopt(_2))
00375       .def("_AddSkyObject", &MapMode::_AddSkyObject, adopt(_2))
00376       .def("_AddZone", &MapMode::_AddZone, adopt(_2))
00377       .def("_SetCameraFocus", &MapMode::_SetCameraFocus)
00378       .def("_SetMapState", &MapMode::_SetMapState)
00379       .def("_GetMapState", &MapMode::_GetMapState)
00380       .def("_GetGeneratedObjectID", &MapMode::_GetGeneratedObjectID)
00381 
00382       .scope
00383       [
00384         def("_ShowDialogueIcons", &MapMode::_ShowDialogueIcons),
00385         def("_IsShowingDialogueIcons", &MapMode::_IsShowingDialogueIcons)
00386       ]
00387 
00388       // Namespace constants
00389       .enum_("constants") [
00390         // Map states
00391         value("EXPLORE", EXPLORE),
00392         value("DIALOGUE", DIALOGUE),
00393         value("OBSERVATION", OBSERVATION),
00394         // Object types
00395         value("PHYSICAL_TYPE", PHYSICAL_TYPE),
00396         value("VIRTUAL_TYPE", VIRTUAL_TYPE),
00397         value("SPRITE_TYPE", SPRITE_TYPE),
00398         // Sprite directions
00399         value("NORTH", NORTH),
00400         value("SOUTH", SOUTH),
00401         value("EAST", WEST),
00402         value("WEST", EAST),
00403         value("NW_NORTH", NW_NORTH),
00404         value("NW_WEST", NW_WEST),
00405         value("NE_NORTH", NE_NORTH),
00406         value("NE_EAST", NE_EAST),
00407         value("SW_SOUTH", SW_SOUTH),
00408         value("SW_WEST", SW_WEST),
00409         value("SE_SOUTH", SE_SOUTH),
00410         value("SE_EAST", SE_EAST),
00411         // Sprite animations
00412         value("ANIM_STANDING_SOUTH", ANIM_STANDING_SOUTH),
00413         value("ANIM_STANDING_NORTH", ANIM_STANDING_NORTH),
00414         value("ANIM_STANDING_WEST", ANIM_STANDING_WEST),
00415         value("ANIM_STANDING_EAST", ANIM_STANDING_EAST),
00416         value("ANIM_WALKING_SOUTH", ANIM_WALKING_SOUTH),
00417         value("ANIM_WALKING_NORTH", ANIM_WALKING_NORTH),
00418         value("ANIM_WALKING_WEST", ANIM_WALKING_WEST),
00419         value("ANIM_WALKING_EAST", ANIM_WALKING_EAST),
00420         // Sprite speeds
00421         value("VERY_SLOW_SPEED", static_cast<uint32>(VERY_SLOW_SPEED)),
00422         value("SLOW_SPEED", static_cast<uint32>(SLOW_SPEED)),
00423         value("NORMAL_SPEED", static_cast<uint32>(NORMAL_SPEED)),
00424         value("FAST_SPEED", static_cast<uint32>(FAST_SPEED)),
00425         value("VERY_FAST_SPEED", static_cast<uint32>(VERY_FAST_SPEED)),
00426         // Map dialogues
00427         value("DIALOGUE_INFINITE", DIALOGUE_INFINITE)
00428       ]
00429   ];
00430 
00431   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00432   [
00433     class_<MapObject>("MapObject")
00434       .def("SetObjectID", &MapObject::SetObjectID)
00435       .def("SetContext", &MapObject::SetContext)
00436       .def("SetXPosition", &MapObject::SetXPosition)
00437       .def("SetYPosition", &MapObject::SetYPosition)
00438       .def("SetImgHalfWidth", &MapObject::SetImgHalfWidth)
00439       .def("SetImgHeight", &MapObject::SetImgHeight)
00440       .def("SetCollHalfWidth", &MapObject::SetCollHalfWidth)
00441       .def("SetCollHeight", &MapObject::SetCollHeight)
00442       .def("SetUpdatable", &MapObject::SetUpdatable)
00443       .def("SetVisible", &MapObject::SetVisible)
00444       .def("SetNoCollision", &MapObject::SetNoCollision)
00445       .def("SetDrawOnSecondPass", &MapObject::SetDrawOnSecondPass)
00446       .def("GetObjectID", &MapObject::GetObjectID)
00447       .def("GetContext", &MapObject::GetContext)
00448       .def("GetXPosition", &MapObject::GetXPosition)
00449       .def("GetYPosition", &MapObject::GetYPosition)
00450       .def("GetImgHalfWidth", &MapObject::GetImgHalfWidth)
00451       .def("GetImgHeight", &MapObject::GetImgHeight)
00452       .def("GetCollHalfWidth", &MapObject::GetCollHalfWidth)
00453       .def("GetCollHeight", &MapObject::GetCollHeight)
00454       .def("IsUpdatable", &MapObject::IsUpdatable)
00455       .def("IsVisible", &MapObject::IsVisible)
00456       .def("IsNoCollision", &MapObject::IsNoCollision)
00457       .def("IsDrawOnSecondPass", &MapObject::IsDrawOnSecondPass)
00458       // TEMP: because GetXPosition and GetYPostiion seem to give a runtime error in Lua
00459       .def_readonly("x_position", &MapObject::x_position)
00460       .def_readonly("y_position", &MapObject::y_position)
00461   ];
00462 
00463   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00464   [
00465     class_<PhysicalObject, MapObject>("PhysicalObject")
00466       .def(constructor<>())
00467       .def("AddAnimation", &PhysicalObject::AddAnimation)
00468       .def("SetCurrentAnimation", &PhysicalObject::SetCurrentAnimation)
00469       .def("SetAnimationProgress", &PhysicalObject::SetAnimationProgress)
00470       .def("GetCurrentAnimation", &PhysicalObject::GetCurrentAnimation)
00471   ];
00472 
00473   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00474   [
00475     class_<VirtualSprite, MapObject>("VirtualSprite")
00476       .def(constructor<>())
00477       .def("SetDirection", &VirtualSprite::SetDirection)
00478       .def("SetMovementSpeed", &VirtualSprite::SetMovementSpeed)
00479       .def("SetFacePortrait", &VirtualSprite::SetFacePortrait)
00480       .def("GetDirection", &VirtualSprite::GetDirection)
00481       .def("GetMovementSpeed", &VirtualSprite::GetMovementSpeed)
00482       .def("AddAction", &VirtualSprite::AddAction, adopt(_2))
00483       .def("AddDialogue", &VirtualSprite::AddDialogue, adopt(_2))
00484       .def("ShowDialogueIcon", &VirtualSprite::ShowDialogueIcon)
00485       .def("IsShowingDialogueIcon", &VirtualSprite::IsShowingDialogueIcon)
00486       .def_readwrite("current_action", &VirtualSprite::current_action)
00487   ];
00488 
00489   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00490   [
00491     class_<MapSprite, VirtualSprite>("MapSprite")
00492       .def(constructor<>())
00493       .def("SetName", &MapSprite::SetName)
00494       .def("SetWalkSound", &MapSprite::SetWalkSound)
00495       .def("SetCurrentAnimation", &MapSprite::SetCurrentAnimation)
00496       .def("GetWalkSound", &MapSprite::GetWalkSound)
00497       .def("GetCurrentAnimation", &MapSprite::GetCurrentAnimation)
00498       .def("LoadStandardAnimations", &MapSprite::LoadStandardAnimations)
00499   ];
00500 
00501   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00502   [
00503     class_<EnemySprite, MapSprite>("EnemySprite")
00504       .def(constructor<>())
00505       .def(constructor<std::string>())
00506       .def("Reset", &EnemySprite::Reset)
00507       .def("NewEnemyParty", &EnemySprite::NewEnemyParty)
00508       .def("AddEnemy", &EnemySprite::AddEnemy)
00509       .def("GetAggroRange", &EnemySprite::GetAggroRange)
00510       .def("GetTimeToChange", &EnemySprite::GetTimeToChange)
00511       .def("GetTimeToSpawn", &EnemySprite::GetTimeToSpawn)
00512       .def("GetBattleMusicTheme", &EnemySprite::GetBattleMusicTheme)
00513       .def("IsDead", &EnemySprite::IsDead)
00514       .def("IsSpawning", &EnemySprite::IsSpawning)
00515       .def("IsHostile", &EnemySprite::IsHostile)
00516       .def("SetZone", &EnemySprite::SetZone)
00517       .def("SetAggroRange", &EnemySprite::SetAggroRange)
00518       .def("SetTimeToChange", &EnemySprite::SetTimeToChange)
00519       .def("SetTimeToSpawn", &EnemySprite::SetTimeToSpawn)
00520       .def("SetBattleMusicTheme", &EnemySprite::SetBattleMusicTheme)
00521       .def("ChangeStateDead", &EnemySprite::ChangeStateDead)
00522       .def("ChangeStateSpawning", &EnemySprite::ChangeStateSpawning)
00523       .def("ChangeStateHostile", &EnemySprite::ChangeStateHostile)
00524   ];
00525 
00526   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00527   [
00528     class_<ZoneSection>("ZoneSection")
00529       .def(constructor<uint16, uint16, uint16, uint16>())
00530       .def_readwrite("start_row", &ZoneSection::start_row)
00531       .def_readwrite("end_row", &ZoneSection::end_row)
00532       .def_readwrite("start_col", &ZoneSection::start_col)
00533       .def_readwrite("end_col", &ZoneSection::end_col)
00534   ];
00535 
00536   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00537   [
00538     class_<MapZone>("MapZone")
00539       .def(constructor<>())
00540       .def("AddSection", &MapZone::AddSection, adopt(_2))
00541       .def("IsInsideZone", &MapZone::IsInsideZone)
00542   ];
00543 
00544   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00545   [
00546     class_<EnemyZone, MapZone>("EnemyZone")
00547       .def(constructor<uint32, bool>())
00548       .def("AddEnemy", &EnemyZone::AddEnemy, adopt(_2))
00549       .def("IsRestraining", &EnemyZone::IsRestraining)
00550   ];
00551 
00552   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00553   [
00554     class_<MapDialogue>("MapDialogue")
00555       .def(constructor<>())
00556       .def("AddText", &MapDialogue::AddText)
00557   ];
00558 
00559   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00560   [
00561     class_<SpriteAction>("SpriteAction")
00562       .def("Execute", &SpriteAction::Execute)
00563   ];
00564 
00565   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00566   [
00567     class_<ActionPathMove, SpriteAction>("ActionPathMove")
00568       .def(constructor<VirtualSprite*>())
00569       .def("SetDestination", &ActionPathMove::SetDestination)
00570   ];
00571 
00572   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00573   [
00574     class_<ActionRandomMove, SpriteAction>("ActionRandomMove")
00575       .def(constructor<VirtualSprite*>())
00576       .def_readwrite("total_movement_time", &ActionRandomMove::total_movement_time)
00577       .def_readwrite("total_direction_time", &ActionRandomMove::total_direction_time)
00578   ];
00579 
00580   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_map")
00581   [
00582     class_<ActionAnimate, SpriteAction>("ActionAnimate")
00583       .def(constructor<VirtualSprite*>())
00584       .def("AddFrame", &ActionAnimate::AddFrame)
00585       .def("SetLoops", &ActionAnimate::SetLoops)
00586   ];
00587   } // End using map mode namespaces
00588 
00589   // ----- Battle Mode bindings
00590   {
00591   using namespace hoa_battle;
00592   using namespace hoa_battle::private_battle;
00593   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_battle")
00594   [
00595     class_<BattleMode, hoa_mode_manager::GameMode>("BattleMode")
00596       .def(constructor<>())
00597       .def("AddEnemy", (void(BattleMode::*)(uint32)) &BattleMode::AddEnemy)
00598   ];
00599 
00600   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_battle")
00601   [
00602     class_<BattleActor>("BattleActor")
00603       .def(constructor<>())
00604       .def("SetHitPoints", &BattleActor::SetHitPoints)
00605       .def("SetMaxHitPoints", &BattleActor::SetMaxHitPoints)
00606       .def("SetSkillPoints", &BattleActor::SetSkillPoints)
00607       .def("SetMaxSkillPoints", &BattleActor::SetMaxSkillPoints)
00608       .def("SetStrength", &BattleActor::SetStrength)
00609       .def("SetVigor", &BattleActor::SetVigor)
00610       .def("SetFortitude", &BattleActor::SetFortitude)
00611       .def("SetProtection", &BattleActor::SetProtection)
00612       .def("SetAgility", &BattleActor::SetAgility)
00613       .def("SetEvade", &BattleActor::SetEvade)
00614       .def("GetHitPoints", &BattleActor::GetHitPoints)
00615       .def("GetMaxHitPoints", &BattleActor::GetMaxHitPoints)
00616       .def("GetSkillPoints", &BattleActor::GetSkillPoints)
00617       .def("GetMaxSkillPoints", &BattleActor::GetMaxSkillPoints)
00618       .def("GetStrength", &BattleActor::GetStrength)
00619       .def("GetVigor", &BattleActor::GetVigor)
00620       .def("GetFortitude", &BattleActor::GetFortitude)
00621       .def("GetProtection", &BattleActor::GetProtection)
00622       .def("GetAgility", &BattleActor::GetAgility)
00623       .def("GetEvade", &BattleActor::GetEvade)
00624       .def("GetPhysicalAttack", &BattleActor::GetPhysicalAttack)
00625       .def("GetMetaPhysicalAttack", &BattleActor::GetMetaPhysicalAttack)
00626       .def("GetPhysicalDefense", &BattleActor::GetPhysicalDefense)
00627       .def("GetMetaPhysicalDefense", &BattleActor::GetMetaPhysicalDefense)
00628       .def("GetCombatEvade", &BattleActor::GetCombatEvade)
00629       .def("TakeDamage", &BattleActor::TakeDamage)
00630       .def("OnDeath", &BattleActor::OnDeath)
00631       .def("OnLife", &BattleActor::OnLife)
00632   ];
00633   } // End using battle mode namespaces
00634 
00635 
00636 
00637   // ----- Shop Mode bindings
00638   {
00639   using namespace hoa_shop;
00640 
00641   module(hoa_script::ScriptManager->GetGlobalState(), "hoa_shop")
00642   [
00643     class_<ShopMode, hoa_mode_manager::GameMode>("ShopMode")
00644       .def(constructor<>())
00645       .def("AddObject", &ShopMode::AddObject)
00646   ];
00647 
00648   } // End using shop mode namespaces
00649 
00650 
00651 
00652   // ---------- (4) Bind engine class objects
00653   luabind::object global_table = luabind::globals(hoa_script::ScriptManager->GetGlobalState());
00654   global_table["AudioManager"]     = hoa_audio::AudioManager;
00655   global_table["InputManager"]     = hoa_input::InputManager;
00656   global_table["ModeManager"]      = hoa_mode_manager::ModeManager;
00657   global_table["ScriptManager"]    = hoa_script::ScriptManager;
00658   global_table["SystemManager"]    = hoa_system::SystemManager;
00659   global_table["VideoManager"]     = hoa_video::VideoManager;
00660 
00661 } // void BindEngineToLua()
00662 
00663 } // namespace hoa_defs

Generated on Fri Jul 6 23:11:12 2007 for Hero of Allacrost by  doxygen 1.5.1