V-Gears 0
Free Final Fantasy VII engine.
ScriptManagerBinds.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <iostream>
17
18#include "../modules/worldmap/WorldmapModule.h"
19#include "Console.h"
20#include "Logger.h"
21#include "CameraManager.h"
22#include "Enemy.h"
23#include "Entity.h"
24#include "EntityManager.h"
25#include "BattleManager.h"
26#include "AudioManager.h"
27#include "SavemapHandler.h"
28#include "Timer.h"
29#include "UiManager.h"
30#include "UiWidget.h"
31#include "XmlMapFile.h"
32#include "XmlMapsFile.h"
33#include "DialogsManager.h"
34#include "TextHandler.h"
35
36
37/*
38 * TODO:
39 *
40 * If I manage to upgrade luabind version (or even better, remove it and use an external one),
41 * I could pass entire objects to Lua scripts as tables, and this will be waaaaay easier.
42 */
43
49void ScriptPrint(const char* text){
50 std::cout << "[SCRIPT] " << text << std::endl;
51 Console::getSingleton().AddTextToOutput(text);
52}
53
62void ScriptMap(const char* text){
63 EntityManager::getSingleton().Clear();
64 XmlMapsFile xml("./data/fields/_fields.xml");
65 Ogre::String file_name = xml.GetMapFileNameByName(text);
66 XmlMapFile xml_map("./data/fields/" + file_name);
67 xml_map.LoadMap();
68}
69
78void ScriptConsole(const char* text){
79 Console::getSingleton().ExecuteCommand(text);
80}
81
83
84 // Global functions.
85 luabind::module(lua_state_)[
86 luabind::def("print", (void(*)(const char*)) &ScriptPrint),
87 luabind::def("map", (void(*)(const char*)) &ScriptMap),
88 luabind::def("console", (void(*)(const char*)) &ScriptConsole)
89 ];
90
91 // Individual entity commands.
92 luabind::module(lua_state_)[
93 luabind::class_<Entity>("Entity")
94 .def(
95 "set_position",
96 (void(Entity::*)(const float, const float, const float)) &Entity::ScriptSetPosition
97 )
98 // Internally returns 3 values:
99 .def("get_position", (void(Entity::*)()) &Entity::ScriptGetPosition)
100 .def("set_rotation", (void(Entity::*)(const float)) &Entity::ScriptSetRotation)
101 .def("get_rotation", (float(Entity::*)()) &Entity::ScriptGetRotation)
102 .def("set_solid_radius", (void(Entity::*)(const float)) &Entity::SetSolidRadius)
103 .def("get_solid_radius", (float(Entity::*)()) &Entity::GetSolidRadius)
104 .def("set_solid", (void(Entity::*)(const bool)) &Entity::SetSolid)
105 .def("is_solid", (bool(Entity::*)()) &Entity::IsSolid)
106 .def("set_talk_radius", (void(Entity::*)(const float)) &Entity::SetTalkRadius)
107 .def("get_talk_radius", (float(Entity::*)()) &Entity::GetTalkRadius)
108 // Some old test script use this, its just an alias for SetTalkable:
109 .def("set_interactable", (void(Entity::*)(const bool)) &Entity::SetTalkable)
110 .def("set_talkable", (void(Entity::*)(const bool)) &Entity::SetTalkable)
111 .def("is_talkable", (bool(Entity::*)()) &Entity::IsTalkable)
112 .def("set_visible", (void(Entity::*)(const bool)) &Entity::SetVisible)
113 .def("is_visible", (bool(Entity::*)()) &Entity::IsVisible)
114 .def("set_move_auto_speed", (void(Entity::*)(const float)) &Entity::SetMoveAutoSpeed)
115 .def("get_move_auto_speed", (float(Entity::*)()) &Entity::GetMoveAutoSpeed)
116 .def("get_move_triangle_id", (int(Entity::*)()) &Entity::GetMoveTriangleId)
117 .def("set_move_triangle_id", (void(Entity::*)(const int)) &Entity::SetMoveTriangleId)
118 .def("move_auto_rotation", (void(Entity::*)(const bool)) &Entity::SetMoveAutoRotation)
119 .def("move_auto_animation", (void(Entity::*)(const bool)) &Entity::SetMoveAutoAnimation)
120 .def(
121 "move_to_position",
122 (void(Entity::*)(const float, const float)) &Entity::ScriptMoveToPosition
123 )
124 .def("move_to_entity", (void(Entity::*)(Entity*)) &Entity::ScriptMoveToEntity)
125 .def("move_sync", (int(Entity::*)()) &Entity::ScriptMoveSync, luabind::yield)
126 .def(
127 "linear_to_position",
128 (void(Entity::*)(
129 const float, const float, const float, const LinearMovement,
130 const char*, const float, const int
132 )
133 .def(
134 "linear_sync", (int(Entity::*)()) &Entity::ScriptLinearSync, luabind::yield
135 )
136 .def(
137 "jump_to_position",
138 (void(Entity::*)(const float, const float, const float, const float, const int))
140 )
141 .def("jump_sync", (int(Entity::*)()) &Entity::ScriptJumpSync, luabind::yield)
142 .def(
143 "offset_to_position",
144 (void(Entity::*)(const float, const float, const float, const ActionType, const float))
146 )
147 .def("offset_sync", (int(Entity::*)()) &Entity::ScriptOffsetSync, luabind::yield)
148 .def(
149 "turn_to_entity",
150 (void(Entity::*)(Entity*, const TurnDirection, const float)) &Entity::ScriptTurnToEntity
151 )
152 .def(
153 "turn_to_direction", (
154 void(Entity::*)(const float, const TurnDirection, const ActionType, const float)
156 .def("turn_sync", (int(Entity::*)()) &Entity::ScriptTurnSync, luabind::yield)
157 .def(
158 "set_animation_speed", (void(Entity::*)(const float)) &Entity::ScriptSetAnimationSpeed
159 )
160 .def("play_animation", (void(Entity::*)(const char*)) &Entity::ScriptPlayAnimation)
161 .def(
162 "play_animation_stop", (void(Entity::*)(const char*)) &Entity::ScriptPlayAnimationStop
163 )
164 .def(
165 "play_animation",
166 (void(Entity::*)(const char*, const float, const float)) &Entity::ScriptPlayAnimation
167 )
168 .def(
169 "play_animation_stop",
170 (void(Entity::*)(const char*, const float, const float))
172 )
173 .def(
174 "set_default_animation",
175 (void(Entity::*)(const char*)) &Entity::ScriptSetDefaultAnimation
176 )
177 .def("animation_sync", (int(Entity::*)()) &Entity::ScriptAnimationSync, luabind::yield)
178 .enum_("constants")[
179 luabind::value("NONE", AT_NONE),
180 luabind::value("LINEAR", AT_LINEAR),
181 luabind::value("SMOOTH", AT_SMOOTH),
182 luabind::value("CLOCKWISE", TD_CLOCKWISE),
183 luabind::value("ANTICLOCKWISE", TD_ANTICLOCKWISE),
184 luabind::value("CLOSEST", TD_CLOSEST),
185 luabind::value("UP_TO_DOWN", LM_UP_TO_DOWN),
186 luabind::value("DOWN_TO_UP", LM_DOWN_TO_UP),
187 luabind::value("LEFT_TO_RIGHT", LM_LEFT_TO_RIGHT),
188 luabind::value("RIGHT_TO_LEFT", LM_RIGHT_TO_LEFT)
189 ]
190 ];
191
192 // Field commands.
193 // TODO: Duplicated in group EntityManager, this can probably be deleted
194 luabind::module(lua_state_)[
195 luabind::class_<EntityManager>("Field")
196 .def(
197 "random_encounters_on",
199 )
200 ];
201
202 // Entity individual point commands
203 luabind::module(lua_state_)[
204 luabind::class_<EntityPoint>("EntityPoint")
205 // Internally returns 3 values:
206 .def("get_position", (void(EntityPoint::*)()) &EntityPoint::ScriptGetPosition)
207 .def("get_rotation", (float(EntityPoint::*)()) &EntityPoint::ScriptGetRotation)
208 ];
209
210 // Commands for the entity manager, not related to any particular entity.
211 luabind::module(lua_state_)[
212 luabind::class_<EntityManager>("EntityManager")
213 .def("set_paused", (void(EntityManager::*)(const bool)) &EntityManager::ScriptSetPaused)
214 .def(
215 "add_entity",
216 (void(EntityManager::*)(
217 const char*, const char*, const float,const float,
218 const float, const float, const int
220 )
221 .def(
222 "add_entity_script",
224 )
225 .def(
226 "get_entity", (Entity*(EntityManager::*)(const char*)) &EntityManager::ScriptGetEntity
227 )
228 .def(
229 "get_entity_from_index",
231 )
232 .def(
233 "get_entity_from_character_id",
235 )
236 .def(
237 "get_entity_point",
239 )
240 .def(
241 "set_player_entity",
243 )
244 .def(
245 "get_player_entity",
247 )
248 .def(
249 "unset_player_entity",
251 )
252 .def(
253 "player_lock", (void(EntityManager::*)(const bool)) &EntityManager::ScriptPlayerLock
254 )
255 .def(
256 "random_encounters_on",
258 )
259 .def("is_key_on", (bool(EntityManager::*)(unsigned int)) &EntityManager::IsKeyOn)
260 .def("is_key_off", (bool(EntityManager::*)(unsigned int)) &EntityManager::IsKeyOff)
261 .def(
262 "set_entity_to_character",
263 (void(EntityManager::*)(const char*, unsigned int)) &EntityManager::SetEntityToCharacter
264 )
265 ];
266
267 // Commands for the battle manager.
268 luabind::module(lua_state_)[
269 luabind::class_<BattleManager>("BattleManager")
270 .def(
271 "start_battle", (void(BattleManager::*)(const unsigned int)) &BattleManager::StartBattle
272 )
273 .def("end_battle", (void(BattleManager::*)()) &BattleManager::EndBattle)
274 .def("get_enemy_count", (int(BattleManager::*)()) &BattleManager::ScriptGetEnemyCount)
275 .def(
276 "get_enemy",
277 (Enemy*(BattleManager::*)(const unsigned int)) &BattleManager::ScriptGetEnemy
278 )
279 ];
280
281 // Commands for enemy handling.
282 luabind::module(lua_state_)[
283 luabind::class_<Enemy>("Enemy")
284 .def("get_id", (int(Enemy::*)()) &Enemy::GetId)
285 .def("get_name", (std::string(Enemy::*)()) &Enemy::GetName)
286 .def("get_level", (int(Enemy::*)()) &Enemy::GetLevel)
287 .def("get_ap", (int(Enemy::*)()) &Enemy::GetAp)
288 .def("get_exp", (int(Enemy::*)()) &Enemy::GetExp)
289 .def("get_money", (int(Enemy::*)()) &Enemy::GetMoney)
290 .def("get_str", (int(Enemy::*)()) &Enemy::GetStr)
291 .def("get_def", (int(Enemy::*)()) &Enemy::GetDef)
292 .def("get_mag", (int(Enemy::*)()) &Enemy::GetMag)
293 .def("get_spr", (int(Enemy::*)()) &Enemy::GetSpr)
294 .def("get_dex", (int(Enemy::*)()) &Enemy::GetDex)
295 .def("get_lck", (int(Enemy::*)()) &Enemy::GetLck)
296 .def("get_eva", (int(Enemy::*)()) &Enemy::GetEva)
297 .def("get_meva", (int(Enemy::*)()) &Enemy::GetMeva)
298 .def("get_hp", (int(Enemy::*)()) &Enemy::GetHp)
299 .def("get_hp_max", (int(Enemy::*)()) &Enemy::GetHpMax)
300 .def("get_mp", (int(Enemy::*)()) &Enemy::GetMp)
301 .def("get_mp_max", (int(Enemy::*)()) &Enemy::GetMpMax)
302 .def("get_position", (void(Enemy::*)()) &Enemy::ScriptGetPos)
303 .def("is_front", (bool(Enemy::*)()) &Enemy::IsFront)
304 .def("is_visible", (bool(Enemy::*)()) &Enemy::IsVisible)
305 .def("is_targeteable", (bool(Enemy::*)()) &Enemy::IsTargeteable)
306 .def("is_active", (bool(Enemy::*)()) &Enemy::IsActive)
307 .def("get_attack_count", (int(Enemy::*)()) &Enemy::ScriptGetAttackCount)
308 .def("get_attack", (int(Enemy::*)(const unsigned int)) &Enemy::ScriptGetAttack)
309 .def(
310 "get_camera_for_attack",
311 (int(Enemy::*)(const unsigned int)) &Enemy::ScriptGetCameraForAttack
312 )
313 // TODO: Implement cover flags.
314 // TODO: Implement immunities
315 // TODO: Implement elements
316 // TODO: Implement item drops
317 // TODO: Implement stealable items
318 // TODO: Implement manipulability status and attacks.
319 // TODO: Implement morph item
320];
321
322 // Commands for the audio manager.
323 luabind::module(lua_state_)[
324 luabind::class_<AudioManager>("AudioManager")
325 .def("play_music", (void(AudioManager::*)(const char*)) &AudioManager::ScriptPlayMusic)
326 .def("play_sound", (void(AudioManager::*)(const char*)) &AudioManager::ScriptPlaySound)
327 .def(
328 "play_sound",
329 (void(AudioManager::*)(const char*, const int)) &AudioManager::ScriptPlaySound
330 )
331 .def(
332 "play_sounds",
333 (void(AudioManager::*)(const char*, const char*, const char*, const char*))
335 )
336 .def("get_track_id", (int(AudioManager::*)(int)) &AudioManager::ScriptGetTrack)
337 .def("get_battle_track_id", (int(AudioManager::*)()) &AudioManager::ScriptGetBattleTrack)
338 .def(
339 "set_battle_track_id", (void(AudioManager::*)(int)) &AudioManager::ScriptSetBattleTrack
340 )
341 ];
342
343 // Commands for the audio manager.
344 luabind::module(lua_state_)[
345 luabind::class_<CameraManager>("CameraManager")
346 .def("set_camera",
347 (void(CameraManager::*)(
348 const int, const int, const int, const int, const int, const int
350 )
351 ];
352
353 // Commands for the savemap handelr.
354 luabind::module(lua_state_)[
355 luabind::class_<SavemapHandler>("SavemapHandler")
356 .def(
357 "release", (void(SavemapHandler::*)()) &SavemapHandler::Release
358 )
359 .def(
360 "get_current_savemap",
362 )
363 .def(
364 "get_savemap",
365 (Savemap*(SavemapHandler::*)(const unsigned int)) &SavemapHandler::GetSavemap
366 )
367 .def(
368 "set_data",
369 (void(SavemapHandler::*)(const unsigned int, const unsigned int, const int))
371 )
372 .def(
373 "set_control_key", (void(SavemapHandler::*)(const char*)) &SavemapHandler::SetControlKey
374 )
375 .def(
376 "set_window_colours",
377 (void(SavemapHandler::*)(
378 const unsigned int, const unsigned int, const unsigned int,
379 const unsigned int, const unsigned int, const unsigned int,
380 const unsigned int, const unsigned int, const unsigned int,
381 const unsigned int, const unsigned int, const unsigned int
383 )
384 .def("set_money", (void(SavemapHandler::*)(const unsigned int)) &SavemapHandler::SetMoney)
385 .def(
386 "set_game_time",
387 (void(SavemapHandler::*)(const unsigned int)) &SavemapHandler::SetGameTime
388 )
389 .def(
390 "set_countdown_time",
391 (void(SavemapHandler::*)(const unsigned int)) &SavemapHandler::SetCountdownTime
392 )
393 .def(
394 "set_key_item",
395 (void(SavemapHandler::*)(const unsigned int, const bool)) &SavemapHandler::SetKeyItem
396 )
397 .def(
398 "set_party",
399 (void(SavemapHandler::*)(const int, const int, const int)) &SavemapHandler::SetParty
400 )
401 .def(
402 "set_item",
403 (void(SavemapHandler::*)(const unsigned int, const unsigned int, const unsigned int))
405 )
406 .def(
407 "set_materia",
408 (void(SavemapHandler::*)(const unsigned int, const unsigned int, const unsigned int))
410 )
411 .def(
412 "set_e_skill_materia",
413 (void(SavemapHandler::*)(const unsigned int, const unsigned int, const bool))
415 )
416 .def(
417 "set_materia_stash",
418 (void(SavemapHandler::*)(const unsigned int, const unsigned int, const unsigned int))
420 )
421 .def(
422 "set_e_skill_materia_stash",
423 (void(SavemapHandler::*)(const unsigned int, const unsigned int, const bool))
425 )
426 .def(
427 "set_location",
428 (void(SavemapHandler::*)(
429 const float, const float, const float, const unsigned int, const int,
430 const char*, const char*
432 )
433 .def(
434 "set_setting",
435 (void(SavemapHandler::*)(const unsigned int, const unsigned int))
437 )
438 .def(
439 "set_character_info",
440 (void(SavemapHandler::*)(
441 const unsigned int, const int, const char*, const bool, const bool, const unsigned int,
442 const unsigned int, const bool, const unsigned int, const unsigned int,
443 const unsigned int, const unsigned int, const unsigned int, const unsigned int,
444 const int
446 )
447 .def(
448 "set_character_stat",
449 (void(SavemapHandler::*)(
450 const unsigned int, const unsigned int, const unsigned int, const unsigned int
452 )
453 .def(
454 "set_character_limit_learned",
455 (void(SavemapHandler::*)(
456 const unsigned int, const unsigned int, const unsigned int,
457 const bool, const unsigned int
459 )
460 .def(
461 "set_character_materia",
462 (void(SavemapHandler::*)(
463 const unsigned int, const bool, const unsigned int,
464 const unsigned int, const unsigned int
466 )
467 .def(
468 "set_character_e_skill_materia",
469 (void(SavemapHandler::*)(
470 const unsigned int, const bool, const unsigned int, const unsigned int, const bool
472 )
473 .def(
474 "set_character_status",
475 (void(SavemapHandler::*)(const unsigned int, const unsigned int, const bool))
477 )
478 .def(
479 "save", (bool(SavemapHandler::*)(const unsigned int, const bool)) &SavemapHandler::Save
480 )
481 .def(
482 "is_slot_empty",
483 (bool(SavemapHandler::*)(const unsigned int)) &SavemapHandler::IsSlotEmpty
484 )
485 .def(
486 "get_slot_control_key",
487 (std::string(SavemapHandler::*)(const unsigned int)) &SavemapHandler::GetSlotControlKey
488 )
489 .def(
490 "get_slot_control_key",
491 (unsigned int(SavemapHandler::*)(
492 const unsigned int, const unsigned int, const unsigned int
494 )
495 .def(
496 "get_slot_money",
497 (unsigned int(SavemapHandler::*)(const unsigned int)) &SavemapHandler::GetSlotMoney
498 )
499 .def(
500 "get_slot_game_time",
501 (unsigned int(SavemapHandler::*)(const unsigned int)) &SavemapHandler::GetSlotGameTime
502 )
503 .def(
504 "get_slot_countdown_time",
505 (unsigned int(SavemapHandler::*)(const unsigned int))
507 )
508 .def(
509 "get_slot_party_member",
510 (int(SavemapHandler::*)(const unsigned int, const unsigned int))
512 )
513 .def(
514 "get_slot_item_at_pos_id",
515 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
517 )
518 .def(
519 "get_slot_item_at_pos_qty",
520 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
522 )
523 .def(
524 "get_slot_key_item",
525 (bool(SavemapHandler::*)(const unsigned int, const unsigned int))
527 )
528 .def(
529 "get_slot_materia_at_pos_id",
530 (int(SavemapHandler::*)(const unsigned int, const unsigned int))
532 )
533 .def(
534 "get_slot_materia_at_pos_ap",
535 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
537 )
538 .def(
539 "is_slot_materia_at_pos_e_skill",
540 (bool(SavemapHandler::*)(const unsigned int, const unsigned int))
542 )
543 .def(
544 "is_slot_materia_at_pos_e_skill_learned",
545 (bool(SavemapHandler::*)(
546 const unsigned int, const unsigned int, const unsigned int
548 )
549 .def(
550 "get_slot_stash_at_pos_id",
551 (int(SavemapHandler::*)(const unsigned int, const unsigned int))
553 )
554 .def(
555 "get_slot_stash_at_pos_ap",
556 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
558 )
559 .def(
560 "is_slot_stash_at_pos_e_skill",
561 (bool(SavemapHandler::*)(const unsigned int, const unsigned int))
563 )
564 .def(
565 "is_slot_stash_at_pos_e_skill_learned",
566 (bool(SavemapHandler::*)(
567 const unsigned int, const unsigned int, const unsigned int
569 )
570 .def(
571 "get_slot_location_x",
572 (float(SavemapHandler::*)(const unsigned int)) &SavemapHandler::GetSlotLocationX
573 )
574 .def(
575 "get_slot_location_y",
576 (float(SavemapHandler::*)(const unsigned int)) &SavemapHandler::GetSlotLocationY
577 )
578 .def(
579 "get_slot_location_z",
580 (float(SavemapHandler::*)(const unsigned int)) &SavemapHandler::GetSlotLocationZ
581 )
582 .def(
583 "get_slot_location_triangle",
584 (unsigned int(SavemapHandler::*)(const unsigned int))
586 )
587 .def(
588 "get_slot_location_angle",
589 (unsigned int(SavemapHandler::*)(const unsigned int))
591 )
592 .def(
593 "get_slot_location_field",
594 (std::string(SavemapHandler::*)(const unsigned int))
596 )
597 .def(
598 "get_slot_location_name",
599 (std::string(SavemapHandler::*)(const unsigned int))
601 )
602 .def(
603 "get_slot_setting",
604 (int(SavemapHandler::*)(const unsigned int, const unsigned int))
606 )
607 .def(
608 "get_slot_character_char_id",
609 (int(SavemapHandler::*)(const unsigned int, const unsigned int))
611 )
612 .def(
613 "get_slot_character_name",
614 (std::string(SavemapHandler::*)(const unsigned int, const unsigned int))
616 )
617 .def(
618 "get_slot_character_level",
619 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
621 )
622 .def(
623 "get_slot_character_kills",
624 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
626 )
627 .def(
628 "is_slot_character_enabled",
629 (bool(SavemapHandler::*)(const unsigned int, const unsigned int))
631 )
632 .def(
633 "is_slot_character_locked",
634 (bool(SavemapHandler::*)(const unsigned int, const unsigned int))
636 )
637 .def(
638 "is_slot_character_back_row",
639 (bool(SavemapHandler::*)(const unsigned int, const unsigned int))
641 )
642 .def(
643 "get_slot_character_exp",
644 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
646 )
647 .def(
648 "get_slot_character_exp_to_next",
649 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
651 )
652 .def(
653 "get_slot_character_limit_level",
654 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
656 )
657 .def(
658 "get_slot_character_limit_bar",
659 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
661 )
662 .def(
663 "get_slot_character_weapon_id",
664 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
666 )
667 .def(
668 "get_slot_character_armor_id",
669 (unsigned int(SavemapHandler::*)(const unsigned int, const unsigned int))
671 )
672 .def(
673 "get_slot_character_accessory_id",
674 (int(SavemapHandler::*)(const unsigned int, const unsigned int))
676 )
677 .def(
678 "get_slot_character_stat_base",
679 (unsigned int(SavemapHandler::*)(
680 const unsigned int, const unsigned int, const unsigned int
682 )
683 .def(
684 "get_slot_character_stat_extra",
685 (unsigned int(SavemapHandler::*)(
686 const unsigned int, const unsigned int, const unsigned int
688 )
689 .def(
690 "get_slot_character_limit_uses",
691 (unsigned int(SavemapHandler::*)(
692 const unsigned int, const unsigned int, const unsigned int
694 )
695 .def(
696 "is_slot_character_limit_learned",
697 (unsigned int(SavemapHandler::*)(
698 const unsigned int, const unsigned int, const unsigned int, const unsigned int
700 )
701 .def(
702 "get_slot_character_materia_id",
703 (int(SavemapHandler::*)(
704 const unsigned int, const unsigned int, const bool, const unsigned int
706 )
707 .def(
708 "get_slot_character_materia_ap",
709 (unsigned int(SavemapHandler::*)(
710 const unsigned int, const unsigned int, const bool, const unsigned int
712 )
713 .def(
714 "get_slot_character_materia_e_skill",
715 (bool(SavemapHandler::*)(
716 const unsigned int, const unsigned int, const bool,
717 const unsigned int, const unsigned int
719 )
720 .def(
721 "get_slot_character_materia_e_skill_learned",
722 (bool(SavemapHandler::*)(
723 const unsigned int, const unsigned int, const bool,
724 const unsigned int, const unsigned int
726 )
727 .def(
728 "get_slot_data",
729 (int(SavemapHandler::*)(const unsigned int, const unsigned int, const unsigned int))
731 )
732 ];
733
734 // 2D background and camera commands
735 luabind::module(lua_state_)[
736 luabind::class_<Background2D>("Background2D")
737 .def(
738 "autoscroll_to_entity",
740 )
741 .def(
742 "scroll_to_player",
743 (void(Background2D::*)(const Background2D::SCROLL_TYPE, const unsigned int))
745 )
746 .def(
747 "scroll_to_position",
748 (void(Background2D::*)(
749 const float, const float, const Background2D::SCROLL_TYPE, const float
751 )
752 .def(
753 "scroll_sync", (int(Background2D::*)()) &Background2D::ScriptScrollSync, luabind::yield
754 )
755 .def(
756 "offset", (void(Background2D::*)(const float, const float)) &Background2D::ScriptOffset
757 )
758 .def(
759 "play_animation_looped",
761 )
762 .def(
763 "play_animation_once",
765 )
766 .def(
767 "animation_sync",
768 (int(Background2D::*)(const char*)) &Background2D::ScriptAnimationSync,
769 luabind::yield
770 )
771 .enum_("constants")[
772 luabind::value("NONE", AT_NONE),
773 luabind::value("LINEAR", AT_LINEAR),
774 luabind::value("SMOOTH", AT_SMOOTH)
775 ]
776 ];
777
778 // Walkmesh commands
779 luabind::module(lua_state_)[
780 luabind::class_<Walkmesh>("Walkmesh")
781 .def("lock_walkmesh", (void(Walkmesh ::*)(unsigned int, bool)) &Walkmesh ::LockWalkmesh)
782 .def("is_locked", (bool(Walkmesh ::*)(unsigned int)) &Walkmesh ::IsLocked)
783 ];
784
785 // Text handler commands
786 luabind::module(lua_state_)[
787 luabind::class_<TextHandler>("TextHandler")
788 .def(
789 "set_character_name",
790 (void(TextHandler ::*)(unsigned int, const char*)) &TextHandler::SetCharacterName
791 )
792 .def("set_party", (void(TextHandler ::*)(int, int, int)) &TextHandler::SetParty)
793 ];
794
795 // Dialog commands
796 luabind::module(lua_state_)[
797 luabind::class_<DialogsManager>("Dialog")
798 .def(
799 "dialog_open",
800 (void(DialogsManager::*)(const char*, int, int, int, int)) &DialogsManager::OpenDialog
801 )
802 .def(
803 "set_numeric",
804 (void(DialogsManager::*)(const char*, const bool, const bool))
806 )
807 .def(
808 "update_timer",
809 (void(DialogsManager::*)(const unsigned int)) &DialogsManager::UpdateTimer
810 )
811 .def(
812 "set_mode",
813 (void(DialogsManager::*)(const char*, const unsigned int, const bool))
815 )
816 .def(
817 "dialog_set_text",
818 (void(DialogsManager::*)(const char*, const char*)) &DialogsManager::SetText
819 )
820 .def(
821 "dialog_wait_for_close",
822 (int(DialogsManager::*)(const char*)) &DialogsManager::Sync,
823 luabind::yield
824 )
825 .def("dialog_close", (void(DialogsManager::*)(const char*)) &DialogsManager::Hide)
826 .def(
827 "set_variable",
828 (void(DialogsManager::*)(const char*, const char*, const char*))
830 )
831 .def(
832 "set_clickable",
833 (void(DialogsManager::*)(const char*, const bool)) &DialogsManager::SetClickable
834 )
835 .def(
836 "set_cursor",
837 (void(DialogsManager::*)(const char*, const int, const int)) &DialogsManager::SetCursor
838 )
839 .def("get_cursor", (int(DialogsManager::*)(const char*)) &DialogsManager::GetCursor)
840 .enum_("constants")[
841 luabind::value("SOLID", MSL_SOLID),
842 luabind::value("TRANSPARENT", MSL_TRANSPARENT),
843 luabind::value("NONE", MSL_NONE)
844 ]
845 .def(
846 "set_map_name", (void(DialogsManager::*)(const char*)) &DialogsManager::ScriptSetMapName
847 )
848 .def(
849 "get_map_name", (std::string(DialogsManager::*)()) &DialogsManager::GetMapName
850 )
851 ];
852
853 // UI widget commands
854 luabind::module(lua_state_)[
855 luabind::class_<UiWidget>("UiWidget")
856 .def("set_visible", (void(UiWidget::*)(const bool)) &UiWidget::SetVisible)
857 .def("is_visible", (bool(UiWidget::*)()) &UiWidget::IsVisible)
858 .def("play_animation", (void(UiWidget::*)(const char*)) &UiWidget::ScriptPlayAnimation)
859 .def(
860 "play_animation_stop",
861 (void(UiWidget::*)(const char*)) &UiWidget::ScriptPlayAnimationStop
862 )
863 .def(
864 "play_animation",
865 (void(UiWidget::*)(const char*, const float, const float))
867 )
868 .def(
869 "play_animation_stop",
870 (void(UiWidget::*)(const char*, const float, const float))
872 )
873 .def(
874 "set_default_animation",
875 (void(UiWidget::*)(const char*)) &UiWidget::ScriptSetDefaultAnimation
876 )
877 .def(
878 "animation_sync", (int(UiWidget::*)()) &UiWidget::ScriptAnimationSync, luabind::yield
879 )
880 .def(
881 "set_colour",
882 (void(UiWidget::*)(const float, const float, const float)) &UiWidget::SetColour
883 )
884 .def("set_alpha", (void(UiWidget::*)(const float)) &UiWidget::SetAlpha)
885 .def("set_x", (void(UiWidget::*)(const float, const float)) &UiWidget::SetX)
886 .def("set_y", (void(UiWidget::*)(const float, const float)) &UiWidget::SetY)
887 .def("set_z", (void(UiWidget::*)(const float)) &UiWidget::SetZ)
888 .def("get_width", (float(UiWidget::*)()) &UiWidget::ScriptGetWidth)
889 .def("set_width", (void(UiWidget::*)(const float)) &UiWidget::ScriptSetWidth)
890 .def("set_width", (void(UiWidget::*)(const float, const float)) &UiWidget::SetWidth)
891 .def("get_height", (float(UiWidget::*)()) &UiWidget::ScriptGetHeight)
892 .def("set_height", (void(UiWidget::*)(const float)) &UiWidget::ScriptSetHeight)
893 .def("set_height", (void(UiWidget::*)(const float, const float)) &UiWidget::SetHeight)
894 .def("set_text", (void(UiWidget::*)(const char*)) &UiWidget::SetText)
895 .def("set_image", (void(UiWidget::*)(const char*)) &UiWidget::SetImage)
896 ];
897
898 // UI manager commands. Use to get a specific widget.
899 luabind::module(lua_state_)[
900 luabind::class_<UiManager>("UiManager")
901 .def("get_widget", (UiWidget*(UiManager::*)(const char*)) &UiManager::ScriptGetWidget)
902 ];
903
904 // Timer command. To show a in-game timer.
905 luabind::module(lua_state_)[
906 luabind::class_<Timer>("Timer")
907 .def("get_game_time_total", (float(Timer::*)()) &Timer::GetGameTimeTotal)
908 .def("set_timer", (float(Timer::*)(const float)) &Timer::SetGameTimer)
909 .def("get_timer", (int(Timer::*)()) &Timer::GetGameTimer)
910 ];
911
912 // Commands that control script execution
913 luabind::module(lua_state_)[
914 luabind::class_<ScriptManager>("Script")
915 .def(
916 "wait", (int(ScriptManager::*)(const float)) &ScriptManager::ScriptWait, luabind::yield
917 )
918 .def(
919 "request",
920 (void(ScriptManager::*)(const ScriptManager::Type, const char*, const char*, const int))
922 )
923 .def(
924 "request_start_sync",
925 (int(ScriptManager::*)(const ScriptManager::Type, const char*, const char*, const int))
927 luabind::yield
928 )
929 .def(
930 "request_end_sync",
931 (int(ScriptManager::*) (const ScriptManager::Type, const char*, const char*, const int))
933 luabind::yield
934 )
935 .enum_("constants")[
936 luabind::value("SYSTEM", ScriptManager::SYSTEM),
937 luabind::value("ENTITY", ScriptManager::ENTITY),
938 luabind::value("UI", ScriptManager::UI)
939 ]
940 ];
941
942 // Commnds to initiate modules
943 luabind::module(lua_state_)[
944 luabind::class_<VGears::WorldmapModule>("world_map_module")
945 .def("init", (void(VGears::WorldmapModule::*)()) &VGears::WorldmapModule::Init)
946 ];
947
948 // Register all command handlers
949 auto a = boost::ref(*(EntityManager::getSingletonPtr()));
950 luabind::globals(lua_state_);
951 //auto b = luabind::globals(lua_state_)["entity_manager"];
952 luabind::globals(lua_state_)["camera_manager"]
953 = boost::ref(*(CameraManager::getSingletonPtr()));
954 luabind::globals(lua_state_)["entity_manager"]
955 = boost::ref(*(EntityManager::getSingletonPtr()));
956 luabind::globals(lua_state_)["battle_manager"]
957 = boost::ref(*(BattleManager::getSingletonPtr()));
958 luabind::globals(lua_state_)["audio_manager"] = boost::ref(*(AudioManager::getSingletonPtr()));
959 luabind::globals(lua_state_)["savemap_manager"]
960 = boost::ref(*(SavemapHandler::getSingletonPtr()));
961 luabind::globals(lua_state_)["background2d"]
962 = boost::ref(*(EntityManager::getSingletonPtr()->GetBackground2D()));
963 luabind::globals(lua_state_)["walkmesh"]
964 = boost::ref(*(EntityManager::getSingletonPtr()->GetWalkmesh()));
965 luabind::globals(lua_state_)["text_manager"] = boost::ref(*(TextHandler::getSingletonPtr()));
966 luabind::globals(lua_state_)["dialog"] = boost::ref(*(DialogsManager::getSingletonPtr()));
967 luabind::globals(lua_state_)["ui_manager"] = boost::ref(*(UiManager::getSingletonPtr()));
968 luabind::globals(lua_state_)["world_map_module"]
969 = boost::ref(*(VGears::WorldmapModule::getSingletonPtr()));
970 luabind::globals(lua_state_)["timer"] = boost::ref(*(Timer::getSingletonPtr()));
971 luabind::globals(lua_state_)["script"] = boost::ref(*this);
972}
@ MSL_SOLID
Regular message box, solid background.
Definition: DialogsManager.h:64
@ MSL_TRANSPARENT
Translucent message box.
Definition: DialogsManager.h:69
@ MSL_NONE
No message box.
Definition: DialogsManager.h:74
ActionType
Action types.
Definition: Entity.h:26
@ AT_SMOOTH
Smooth action.
Definition: Entity.h:46
@ AT_LINEAR
Linear action.
Definition: Entity.h:38
@ AT_NONE
No action.
Definition: Entity.h:31
TurnDirection
The direction for an entity turn.
Definition: Entity.h:52
@ TD_CLOSEST
Choose direction automatically.
Definition: Entity.h:69
@ TD_CLOCKWISE
Turn clockwise.
Definition: Entity.h:57
@ TD_ANTICLOCKWISE
Turn anticlockwise.
Definition: Entity.h:62
LinearMovement
Linear movement modes.
Definition: Entity.h:75
@ LM_UP_TO_DOWN
Move down.
Definition: Entity.h:80
@ LM_RIGHT_TO_LEFT
Move left.
Definition: Entity.h:95
@ LM_LEFT_TO_RIGHT
Move right.
Definition: Entity.h:90
@ LM_DOWN_TO_UP
Move up.
Definition: Entity.h:85
void ScriptPrint(const char *text)
Prints to the game console.
Definition: ScriptManagerBinds.h:49
void ScriptConsole(const char *text)
Executes a script in the game console.
Definition: ScriptManagerBinds.h:78
void ScriptMap(const char *text)
Changes the current map.
Definition: ScriptManagerBinds.h:62
uint16 a
Alpha component.
Definition: TxzFileSerializer.h:19
The audio manager.
Definition: AudioManager.h:39
void ScriptSetBattleTrack(int id)
Sets the music track for upcoming battles.
Definition: AudioManager.cpp:234
void ScriptPlaySounds(const char *name1, const char *name2, const char *name3, const char *name4)
Plays up to 4 sounds, in 4 different channels.
Definition: AudioManager.cpp:166
int ScriptGetBattleTrack()
Retrieves the music ID for the current or next battle.
Definition: AudioManager.cpp:232
int ScriptGetTrack(int id)
Retrieves the music ID for the specified track for a field or world map.
Definition: AudioManager.cpp:227
void ScriptPlaySound(const char *name)
Plays a sound.
Definition: AudioManager.cpp:159
void ScriptPlayMusic(const char *name)
Plays a music track.
Definition: AudioManager.cpp:120
A field background.
Definition: Background2D.h:29
int ScriptAnimationSync(const char *name)
Plays an animation once, then stops.
Definition: Background2D.cpp:633
void ScriptScrollToPosition(const float x, const float y, const SCROLL_TYPE type, const float seconds)
Scrolls the background to a position.
Definition: Background2D.cpp:282
void ScriptOffset(const float x, const float y)
Offsets the background to a position.
Definition: Background2D.cpp:312
void ScriptScrollToPlayer(const SCROLL_TYPE type, const unsigned int seconds)
Scrolls the background to the position of the playable character.
Definition: Background2D.cpp:269
void ScriptPlayAnimationOnce(const char *name)
Plays an animation once, then stops.
Definition: Background2D.cpp:629
int ScriptScrollSync()
Waits for the scroll to complete.
Definition: Background2D.cpp:302
SCROLL_TYPE
How to scroll the background.
Definition: Background2D.h:38
void ScriptPlayAnimationLooped(const char *name)
Plays an animation in a loop.
Definition: Background2D.cpp:624
void ScriptAutoScrollToEntity(Entity *entity)
Flags the background to automatically scroll to an entity position.
Definition: Background2D.cpp:265
The battle manager.
Definition: BattleManager.h:28
void EndBattle()
Ends the current battle.
Definition: BattleManager.cpp:147
Enemy * ScriptGetEnemy(const unsigned int index)
Retrieves an enemy.
Definition: BattleManager.cpp:195
unsigned int ScriptGetEnemyCount() const
Retrieves the number of enemies in the battle.
Definition: BattleManager.cpp:193
void StartBattle(const unsigned int id)
Starts a battle.
Definition: BattleManager.cpp:103
The camera manager.
Definition: CameraManager.h:26
void ScriptSetCamera(const int x, const int y, const int z, const int d_x, const int d_y, const int d_z)
Sets the camera position and orientation.
Definition: CameraManager.cpp:284
The dialog manager.
Definition: DialogsManager.h:239
void SetVariable(const char *d_name, const char *name, const char *value)
Sets a variable in a dialog.
Definition: DialogsManager.cpp:263
void SetCursor(const char *d_name, const int first_row, const int last_row)
Sets a choice sursor in the dialog.
Definition: DialogsManager.cpp:281
void SetText(const char *d_name, const char *text)
Sets the text of a dialog.
Definition: DialogsManager.cpp:147
int GetCursor(const char *d_name) const
Gets the cursor position in a dialog.
Definition: DialogsManager.cpp:299
void SetMode(const char *d_name, const int bg, const bool closeable)
Sets the window mode.
Definition: DialogsManager.cpp:210
void UpdateTimer(const unsigned int seconds)
Updates the timer.
Definition: DialogsManager.cpp:198
void SetNumeric(const char *d_name, const bool numeric, const bool timer)
Sets or unsets a dialog window as numeric.
Definition: DialogsManager.cpp:172
std::string GetMapName()
Retrieves the current map name.
Definition: DialogsManager.cpp:122
void Hide(const char *d_name)
Closes and hides a dialog window.
Definition: DialogsManager.cpp:250
int Sync(const char *d_name)
Syncs the dialog and makes the script wait until it is closed.
Definition: DialogsManager.cpp:239
void ScriptSetMapName(const char *text_id)
Sets the map name from a text ID.
Definition: DialogsManager.cpp:115
void SetClickable(const char *d_name, const bool clickable)
Makes the dialog clickable or not.
Definition: DialogsManager.cpp:272
void OpenDialog(const char *d_name, int x, int y, int w, int h)
Opens a dialog.
Definition: DialogsManager.cpp:124
Any enemy in a battle.
Definition: Enemy.h:24
unsigned int GetDef() const
Retrieves the enemy's defense stat.
Definition: Enemy.cpp:165
bool IsFront() const
Checks if the enemy is in the front row.
Definition: Enemy.cpp:225
unsigned int GetSpr() const
Retrieves the enemy's spirit stat.
Definition: Enemy.cpp:173
const int GetId() const
Retrieves the enemy ID.
Definition: Enemy.cpp:94
unsigned int GetMpMax() const
Retrieves the enemy's max MP.
Definition: Enemy.cpp:208
unsigned int GetHp() const
Retrieves the enemy's current HP.
Definition: Enemy.cpp:193
unsigned int GetMeva() const
Retrieves the enemy's magic evasion stat.
Definition: Enemy.cpp:189
bool IsActive() const
Checks whether the enemy's main script is active.
Definition: Enemy.cpp:237
unsigned int GetLevel() const
Retrieves the enemy level.
Definition: Enemy.cpp:106
unsigned int GetDex() const
Retrieves the enemy's dexterity stat.
Definition: Enemy.cpp:177
void ScriptGetPos() const
Retrieves the enemy position.
Definition: Enemy.cpp:219
bool IsVisible() const
Checks the enemy visibility.
Definition: Enemy.cpp:229
unsigned int GetExp() const
Retrieves the EXP gain upon defeating the enemy.
Definition: Enemy.cpp:114
unsigned int GetAp() const
Retrieves the AP gain upon defeating the enemy.
Definition: Enemy.cpp:110
const std::string GetName() const
Retrieves the enemy name.
Definition: Enemy.cpp:102
bool IsTargeteable() const
Checks whether the enemy can be targeted.
Definition: Enemy.cpp:233
unsigned int GetMp() const
Retrieves the enemy's current MP.
Definition: Enemy.cpp:204
int ScriptGetAttack(const unsigned int index)
Retrieves an attack.
Definition: Enemy.cpp:247
int ScriptGetAttackCount()
Retrieves the number of attacks of the enemy.
Definition: Enemy.cpp:245
int ScriptGetCameraForAttack(const unsigned int index)
Retrieves the camera for an attack.
Definition: Enemy.cpp:252
unsigned int GetEva() const
Retrieves the enemy's evasion stat.
Definition: Enemy.cpp:185
unsigned int GetLck() const
Retrieves the enemy's luck stat.
Definition: Enemy.cpp:181
unsigned int GetStr() const
Retrieves the enemy's strength stat.
Definition: Enemy.cpp:161
unsigned int GetMoney() const
Retrieves the money gain upon defeating the enemy.
Definition: Enemy.cpp:118
unsigned int GetHpMax() const
Retrieves the enemy's max HP.
Definition: Enemy.cpp:197
unsigned int GetMag() const
Retrieves the enemy's magic stat.
Definition: Enemy.cpp:169
The entity manager.
Definition: EntityManager.h:30
void ScriptAddEntity(const char *name, const char *file_name, const float x, const float y, const float z, const float direction, int index)
Adds an entity to the manager.
Definition: EntityManager.cpp:507
bool IsKeyOff(unsigned int key_code)
Checks if a key is not being pressed.
Definition: EntityManager.cpp:674
void ScriptAddEntityScript(const char *name)
Adds an entity script to the manager.
Definition: EntityManager.cpp:546
void SetRandomEncounters(bool active)
Enables or disables random encounters in the field.
Definition: EntityManager.cpp:648
void ScriptSetPlayerEntity(const char *name)
Sets the playable entity.
Definition: EntityManager.cpp:597
EntityPoint * ScriptGetEntityPoint(const char *name) const
Retrieves an entity point by name.
Definition: EntityManager.cpp:591
Entity * ScriptGetEntity(const char *name) const
Retrieves an entity by name.
Definition: EntityManager.cpp:587
Entity * ScriptGetPlayerEntity() const
Retrieves the playable entity.
Definition: EntityManager.cpp:613
void ScriptPlayerLock(const bool lock)
Locks or unlocks player control of the playable entity.
Definition: EntityManager.cpp:629
void SetEntityToCharacter(const char *entity_name, unsigned int char_id)
Assigns a character to an entity.
Definition: EntityManager.cpp:676
bool IsKeyOn(unsigned int key_code)
Checks if a key is being pressed.
Definition: EntityManager.cpp:658
Entity * GetEntityFromIndex(const int id) const
Retrieves an entity by it's index in the field.
Definition: EntityManager.cpp:560
void ScriptUnsetPlayerEntity()
Unsets any playable entities.
Definition: EntityManager.cpp:621
Entity * GetEntityFromCharacterId(const int id) const
Retrieves an entity by it's assigned character ID.
Definition: EntityManager.cpp:574
An entity point.
Definition: EntityPoint.h:22
void ScriptGetPosition() const
Informs the script manager of the point position.
Definition: EntityPoint.cpp:64
float ScriptGetRotation() const
Retrieves the point orientation.
Definition: EntityPoint.cpp:87
Any entity in a field.
Definition: Entity.h:101
void ScriptGetPosition() const
Retrieves the entity position.
Definition: Entity.cpp:218
void ScriptPlayAnimationStop(const char *name)
Stops one of the entity's animations.
Definition: Entity.cpp:645
float GetTalkRadius() const
Retrieves the entity talk radius.
Definition: Entity.cpp:299
int ScriptTurnSync()
Adds the entity's turn to the sync queue.
Definition: Entity.cpp:564
void ScriptLinearToPosition(const float x, const float y, const float z, const LinearMovement movement, const char *animation, const float orientation, const int dest_triangle)
Linearly moves the entity.
Definition: Entity.cpp:380
float ScriptGetRotation() const
Retrieves the entity rotation.
Definition: Entity.cpp:262
int ScriptJumpSync()
Waits for the jump to finish.
Definition: Entity.cpp:451
void ScriptPlayAnimation(const char *name)
Plays one of the entity's animations.
Definition: Entity.cpp:641
void ScriptSetAnimationSpeed(const float speed)
Sets the animation speed.
Definition: Entity.cpp:633
void SetSolid(const bool solid)
Makes the entity solid or non-solid.
Definition: Entity.cpp:290
void ScriptTurnToEntity(Entity *entity, const TurnDirection turn_direction, const float seconds)
Makes the entity turn towards another entity.
Definition: Entity.cpp:554
virtual bool IsVisible() const =0
Checks if the entity is visible or invisible.
float GetMoveAutoSpeed() const
Retrieves the entity's automatic movement speed.
Definition: Entity.cpp:311
bool IsTalkable() const
Checks if an entity is talkable or non-talkable.
Definition: Entity.cpp:303
void SetMoveAutoSpeed(const float speed)
Sets the entity's automatic movement speed.
Definition: Entity.cpp:309
int ScriptLinearSync()
Adds the unit linear movement to the sync queue.
Definition: Entity.cpp:392
void SetTalkRadius(const float radius)
Sets the entity talk radius.
Definition: Entity.cpp:294
void ScriptTurnToDirection(const float direction, const TurnDirection turn_direction, const ActionType turn_type, const float seconds)
Makes the entity turn to a fixed direction.
Definition: Entity.cpp:543
void ScriptJumpToPosition(const float x, const float y, const float z, const float seconds, const int dest_triangle)
Makes the unit jump to a point in the field.
Definition: Entity.cpp:437
void ScriptOffsetToPosition(const float x, const float y, const float z, const ActionType type, const float seconds)
Definition: Entity.cpp:495
void ScriptSetPosition(const float x, const float y, const float z)
Sets the entity position.
Definition: Entity.cpp:203
void ScriptMoveToPosition(const float x, const float y)
Makes the entity move to a point in the map.
Definition: Entity.cpp:343
void ScriptSetDefaultAnimation(const char *animation)
Sets the default animation of the entity.
Definition: Entity.cpp:659
void SetMoveAutoRotation(const bool rotate)
Enables or disables autorotation while the entity is moving.
Definition: Entity.cpp:331
void SetSolidRadius(const float radius)
Sets the entity's solid radius.
Definition: Entity.cpp:283
int ScriptMoveSync()
Waits for entity's movement to end.
Definition: Entity.cpp:362
void ScriptMoveToEntity(Entity *entity)
Makes the unit move towards another in the map.
Definition: Entity.cpp:354
void ScriptSetRotation(const float rotation)
Sets the entity rotation.
Definition: Entity.cpp:249
void SetMoveAutoAnimation(const bool animate)
Enables or disables autoanimation while the entity is moving.
Definition: Entity.cpp:335
int ScriptAnimationSync()
Adds the entity's animation to the sync queue.
Definition: Entity.cpp:663
int GetMoveTriangleId() const
Sets the destination triangle in the walkmesh.
Definition: Entity.cpp:329
bool IsSolid() const
Checks if the entity is solid.
Definition: Entity.cpp:292
void SetMoveTriangleId(const int triangle)
Sets the destination triangle in the walkmesh.
Definition: Entity.cpp:327
float GetSolidRadius() const
Retrieves the entity's solid radius.
Definition: Entity.cpp:288
virtual void SetVisible(const bool visible)=0
Makes the entity visible or invisible.
int ScriptOffsetSync()
Definition: Entity.cpp:514
void SetTalkable(const bool talkable)
Sets an entity as talkable or non-talkable.
Definition: Entity.cpp:301
void ScriptSetPaused(const bool paused)
Handles game pausing.
Definition: Manager.cpp:115
A handler for savemaps.
Definition: SavemapHandler.h:26
int GetSlotCharacterCharId(const unsigned int slot, const unsigned int id)
Retrieves the char ID of a character from a saved savemap.
Definition: SavemapHandler.cpp:402
void SetParty(const int member_1, const int member_2, const int member_3)
Sets the current party in the current savemap.
Definition: SavemapHandler.cpp:138
void SetMateriaStash(const unsigned int slot, const int id, const unsigned int ap)
Sets a materia in a materia inventory slot in the current savemap.
Definition: SavemapHandler.cpp:162
bool IsSlotCharacterEnabled(const unsigned int slot, const unsigned int id)
Checks the enabled status of a character from a saved savemap.
Definition: SavemapHandler.cpp:426
void SetESkillMateria(const unsigned slot, const unsigned int skill, const bool learned)
Sets a skill as learned in an Enemy Skill materia inventory slot in the current savemap.
Definition: SavemapHandler.cpp:155
bool IsSlotEmpty(const unsigned int slot)
Checks if a slot is empty.
Definition: SavemapHandler.cpp:240
unsigned int GetSlotCharacterMateriaAp(const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos)
Retrieves the AP of an equipped materia from a saved savemap.
Definition: SavemapHandler.cpp:536
void Release()
Releases savemaps from memory.
Definition: SavemapHandler.cpp:81
unsigned int GetSlotStashAtPosAp(const unsigned int slot, const unsigned int pos)
Retrieves the AP of a materia in the stash from a saved savemap.
Definition: SavemapHandler.cpp:334
unsigned int GetSlotItemAtPosId(const unsigned int slot, const unsigned int pos)
Retrieves the ID of an item in the inventory from a saved savemap.
Definition: SavemapHandler.cpp:284
int GetSlotStashAtPosId(const unsigned int slot, const unsigned int pos)
Retrieves the ID of a materia in the stash from a saved savemap.
Definition: SavemapHandler.cpp:328
unsigned int GetSlotMateriaAtPosAp(const unsigned int slot, const unsigned int pos)
Retrieves the AP of a materia in the inventory from a saved savemap.
Definition: SavemapHandler.cpp:308
bool IsSlotCharacterLimitLearned(const unsigned int slot, const unsigned int id, const unsigned int level, const unsigned int tech)
Checks if a limit technique is learned by a character from a savemap.
Definition: SavemapHandler.cpp:520
bool IsSlotStashAtPosESkillLearned(const unsigned int slot, const unsigned int pos, const unsigned int skill)
Checks if a a enemy skill is learned by a mat.
Definition: SavemapHandler.cpp:346
void SetMoney(const unsigned int money)
Sets the money of the current savemap.
Definition: SavemapHandler.cpp:119
void SetCharacterInfo(const unsigned int id, const int char_id, const char *name, const bool enabled, const bool locked, const unsigned int level, const unsigned int kills, const bool back_row, const unsigned int exp, const unsigned int exp_to_next, const unsigned int limit_level, const unsigned int limit_bar, const unsigned int weapon, const unsigned int armor, const int accessory)
Sets a character basic information in the current savemap.
Definition: SavemapHandler.cpp:187
void SetCountdownTime(const unsigned int seconds)
Sets the time of the curent timer in the default savemap.
Definition: SavemapHandler.cpp:128
void SetData(const unsigned int bank, const unsigned int address, const int value)
Pushes data to the current savemap memory banks.
Definition: SavemapHandler.cpp:97
void SetCharacterMateria(const unsigned int id, const bool weapon, const unsigned int slot, const int materia, const unsigned int ap)
Sets a materia in a character weapon or armor slot in the current savemap.
Definition: SavemapHandler.cpp:217
std::string GetSlotLocationField(const unsigned int slot)
Retrieves the field ID from a saved savemap.
Definition: SavemapHandler.cpp:384
unsigned int GetSlotLocationTriangle(const unsigned int slot)
Retrieves the walkmesh triangle of the player from a saved savemap.
Definition: SavemapHandler.cpp:372
unsigned int GetSlotCharacterWeaponId(const unsigned int slot, const unsigned int id)
Retrieves the ID of the weapon of a character from a saved savemap.
Definition: SavemapHandler.cpp:474
unsigned int GetSlotCharacterKills(const unsigned int slot, const unsigned int id)
Retrieves the total kills of a character from a saved savemap.
Definition: SavemapHandler.cpp:420
unsigned int GetSlotGameTime(const unsigned int slot)
Retrieves the total playtime from a saved savemap.
Definition: SavemapHandler.cpp:266
std::string GetSlotLocationName(const unsigned int slot)
Retrieves the location name from a saved savemap.
Definition: SavemapHandler.cpp:390
bool IsSlotCharacterBackRow(const unsigned int slot, const unsigned int id)
Checks the row of a character from a saved savemap.
Definition: SavemapHandler.cpp:438
int GetSlotPartyMember(const unsigned int slot, const unsigned int pos)
Retrieves the ID of a party member from a saved savemap.
Definition: SavemapHandler.cpp:278
bool Save(unsigned int slot, bool force)
Copies the current savemap to a slot and writes the file.
Definition: SavemapHandler.cpp:51
unsigned int GetSlotItemAtPosQty(const unsigned int slot, const unsigned int pos)
Retrieves the quantity of an item in the inventory from a saved savemap.
Definition: SavemapHandler.cpp:290
std::string GetSlotControlKey(const unsigned int slot)
Retrieves the control key from a saved savemap.
Definition: SavemapHandler.cpp:246
unsigned int GetSlotCharacterLevel(const unsigned int slot, const unsigned int id)
Retrieves the level of a character from a saved savemap.
Definition: SavemapHandler.cpp:414
int GetSlotLocationAngle(const unsigned int slot)
Retrieves the facing angle of the player from a saved savemap.
Definition: SavemapHandler.cpp:378
void SetSetting(const unsigned int key, const unsigned int value)
Sets a setting value in the current savemap.
Definition: SavemapHandler.cpp:182
unsigned int GetSlotCharacterLimitLevel(const unsigned int slot, const unsigned int id)
Retrieves the current limit level of a character from a saved savemap.
Definition: SavemapHandler.cpp:458
void SetWindowColours(const unsigned int t_l_r, const unsigned int t_l_g, const unsigned int t_l_b, const unsigned int t_r_r, const unsigned int t_r_g, const unsigned int t_r_b, const unsigned int b_r_r, const unsigned int b_r_g, const unsigned int b_r_b, const unsigned int b_l_r, const unsigned int b_l_g, const unsigned int b_l_b)
Sets the window colours in the current savemap.
Definition: SavemapHandler.cpp:107
bool IsSlotCharacterMateriaESkill(const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos)
Checks if an equipped materia is Enemy Skill from a saved savemap.
Definition: SavemapHandler.cpp:544
void SetESkillMateriaStash(const unsigned slot, const unsigned int skill, const bool learned)
Sets a skill as learned in an Enemy Skill materia stash slot in the current savemap.
Definition: SavemapHandler.cpp:167
int GetSlotMateriaAtPosId(const unsigned int slot, const unsigned int pos)
Retrieves the ID of a materia in the inventory from a saved savemap.
Definition: SavemapHandler.cpp:302
int GetSlotSetting(const unsigned int slot, const unsigned int key)
Retrieves a setting from a saved savemap.
Definition: SavemapHandler.cpp:396
unsigned int GetSlotMoney(const unsigned int slot)
Retrieves the money from a saved savemap.
Definition: SavemapHandler.cpp:260
void SetControlKey(const char *control)
Sets the control string of the current savemap.
Definition: SavemapHandler.cpp:102
void SetCharacterStat(const unsigned int id, const unsigned int stat, const unsigned int base, const unsigned int extra)
Sets a character stat values in the current savemap.
Definition: SavemapHandler.cpp:202
float GetSlotLocationX(const unsigned int slot)
Retrieves the X coordinate of the player from a saved savemap.
Definition: SavemapHandler.cpp:354
unsigned int GetSlotCharacterLimitUses(const unsigned int slot, const unsigned int id, const unsigned int level)
Retrieves the uses of a character's limit level from a saved savemap.
Definition: SavemapHandler.cpp:512
void SetCharacterLimitLearned(const unsigned int id, const unsigned int level, const unsigned int technique, const bool learned, const unsigned int uses)
Sets a character limit learned status in the current savemap.
Definition: SavemapHandler.cpp:209
bool IsSlotMateriaAtPosESkillLearned(const unsigned int slot, const unsigned int pos, const unsigned int skill)
Checks if a a enemy skill is learned by a materia at a position from a saved savemap.
Definition: SavemapHandler.cpp:320
unsigned int GetSlotCharacterExpToNext(const unsigned int slot, const unsigned int id)
Retrieves the experience for next level of a character from a saved savemap.
Definition: SavemapHandler.cpp:450
std::string GetSlotCharacterName(const unsigned int slot, const unsigned int id)
Retrieves the name of a character from a saved savemap.
Definition: SavemapHandler.cpp:408
bool IsSlotCharacterMateriaESkillLearned(const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos, const unsigned int skill)
Checks if a a enemy skill is learned by a equipped materia from a saved savemap.
Definition: SavemapHandler.cpp:552
int GetSlotCharacterAccessoryId(const unsigned int slot, const unsigned int id)
Retrieves the ID of the accessory of a character from a saved savemap.
Definition: SavemapHandler.cpp:490
Savemap GetCurrentSavemap()
Retrieves the current savemap.
Definition: SavemapHandler.cpp:38
void SetMateria(const unsigned int slot, const int id, const unsigned int ap)
Sets a materia in a materia inventory slot in the current savemap.
Definition: SavemapHandler.cpp:150
unsigned int GetSlotCountdownTime(const unsigned int slot)
Retrieves the time in the timer from a saved savemap.
Definition: SavemapHandler.cpp:272
float GetSlotLocationY(const unsigned int slot)
Retrieves the Y coordinate of the player from a saved savemap.
Definition: SavemapHandler.cpp:360
bool IsSlotMateriaAtPosESkill(const unsigned int slot, const unsigned int pos)
Checks if there is an Enemy Skill materia at a inventory position from a saved savemap.
Definition: SavemapHandler.cpp:314
int GetSlotData(const unsigned int slot, const unsigned int bank, const unsigned int address)
Retrieves the value of a bank address from a saved savemap.
Definition: SavemapHandler.cpp:561
unsigned int GetSlotWindowCornerColourComponent(const unsigned int slot, const unsigned int corner, const unsigned int comp)
Retrieves a colour component from a window corner from a saved savemap.
Definition: SavemapHandler.cpp:252
float GetSlotLocationZ(const unsigned int slot)
Retrieves the Z coordinate of the player from a saved savemap.
Definition: SavemapHandler.cpp:366
void SetCharacterStatus(const unsigned int id, const unsigned int status, const bool inflicted)
Adds or removes a status to a character in the current savemap.
Definition: SavemapHandler.cpp:233
unsigned int GetSlotCharacterLimitBar(const unsigned int slot, const unsigned int id)
Retrieves the current limit bar status level of a character from a saved savemap.
Definition: SavemapHandler.cpp:466
unsigned int GetSlotCharacterStatBase(const unsigned int slot, const unsigned int id, const unsigned int stat)
Retrieves the base value of a stat of a character from a saved savemap.
Definition: SavemapHandler.cpp:496
void SetItem(const unsigned int slot, const unsigned int id, const unsigned int quantity)
Sets an item in a inventory slot in the current savemap.
Definition: SavemapHandler.cpp:143
void SetCharacterESkillMateria(const unsigned int id, const bool weapon, const unsigned int slot, const unsigned int skill, const bool learned)
Sets a skill as learned in a character's Enemy Skill materia in the current savemap.
Definition: SavemapHandler.cpp:225
unsigned int GetSlotCharacterExp(const unsigned int slot, const unsigned int id)
Retrieves the total experience of a character from a saved savemap.
Definition: SavemapHandler.cpp:444
Savemap * GetSavemap(unsigned int slot)
Retrieves a savemap saved in a slot.
Definition: SavemapHandler.cpp:40
int GetSlotCharacterMateriaId(const unsigned int slot, const unsigned int id, const bool weapon, const unsigned int pos)
Retrieves the ID of an equipped materia from a saved savemap.
Definition: SavemapHandler.cpp:528
unsigned int GetSlotCharacterArmorId(const unsigned int slot, const unsigned int id)
Retrieves the ID of the armor of a character from a saved savemap.
Definition: SavemapHandler.cpp:482
void SetLocation(const float x, const float y, const float z, const unsigned int triangle, const int angle, const char *field, const char *name)
Sets the current location in the current savemap.
Definition: SavemapHandler.cpp:174
unsigned int GetSlotCharacterStatExtra(const unsigned int slot, const unsigned int id, const unsigned int stat)
Retrieves the extra value of a stat of a character from a saved savemap.
Definition: SavemapHandler.cpp:504
void SetGameTime(const unsigned int seconds)
Sets the total playtime of the current savemap.
Definition: SavemapHandler.cpp:124
void SetKeyItem(const unsigned int item, const bool owned)
Marks a key item as owned or non-owned in the current savemap.
Definition: SavemapHandler.cpp:133
bool IsSlotStashAtPosESkill(const unsigned int slot, const unsigned int pos)
Checks if there is an Enemy Skill materia at a stash position from a saved savemap.
Definition: SavemapHandler.cpp:340
bool IsSlotCharacterLocked(const unsigned int slot, const unsigned int id)
Checks the lock status of a character from a saved savemap.
Definition: SavemapHandler.cpp:432
bool GetSlotKeyItem(const unsigned int slot, const unsigned int id)
Checks the status of a key item from a saved savemap.
Definition: SavemapHandler.cpp:296
A savemap.
Definition: Savemap.h:24
Definition: ScriptManager.h:131
Type
Script types.
Definition: ScriptManager.h:138
@ UI
A UI element script.
Definition: ScriptManager.h:159
@ ENTITY
A field or world map entity script.
Definition: ScriptManager.h:152
@ SYSTEM
System script.
Definition: ScriptManager.h:145
int ScriptRequestEndSync(const Type type, const char *entity, const char *function, const int priority)
Request a synchronous script execution to end.
Definition: ScriptManager.cpp:572
void InitBinds()
Initializes Lua binds.
Definition: ScriptManagerBinds.h:82
void ScriptRequest(const Type type, const char *entity, const char *function, const int priority)
Request an script execution.
Definition: ScriptManager.cpp:516
int ScriptRequestStartSync(const Type type, const char *entity, const char *function, const int priority)
Request a synchronous script execution to start.
Definition: ScriptManager.cpp:542
int ScriptWait(const float seconds)
Makes an script wait.
Definition: ScriptManager.cpp:501
lua_State * lua_state_
Lua state.
Definition: ScriptManager.h:439
The text handler.
Definition: TextHandler.h:25
void SetParty(int char_1, int char_2, int char_3)
Sets the party member IDs.
Definition: TextHandler.cpp:121
void SetCharacterName(int id, char *name)
Sets a character name.
Definition: TextHandler.cpp:116
The game timer.
Definition: Timer.h:23
float GetGameTimeTotal()
Retrieves the total game time.
Definition: Timer.cpp:40
int GetGameTimer() const
Retrieves the game timer.
Definition: Timer.cpp:57
void SetGameTimer(const float timer)
Sets the game timer.
Definition: Timer.cpp:55
The UI manager.
Definition: UiManager.h:31
UiWidget * ScriptGetWidget(const char *name)
Retrieves a UI widget by name.
Definition: UiManager.cpp:124
An UI widget.
Definition: UiWidget.h:28
void SetHeight(const float percent, const float height)
Sets the height the widget.
Definition: UiWidget.cpp:509
void ScriptSetHeight(float height)
Sets the absolute height of the widget.
Definition: UiWidget.cpp:591
virtual void SetImage(const char *image)
Sets the text of the widget.
Definition: UiWidget.cpp:580
void SetVisible(const bool visible)
Toggles the widget visibility.
Definition: UiWidget.cpp:222
void SetZ(const float z)
Sets the widget Z-index.
Definition: UiWidget.cpp:493
void ScriptSetDefaultAnimation(const char *animation)
Sets the default animation for the widget.
Definition: UiWidget.cpp:290
float ScriptGetWidth()
Retrieves the absolute width of the widget.
Definition: UiWidget.cpp:582
void SetWidth(const float percent, const float width)
Sets the width the widget.
Definition: UiWidget.cpp:498
bool IsVisible() const
Checks the widget visibility.
Definition: UiWidget.cpp:224
virtual void SetText(const char *text)
Sets the text of the widget.
Definition: UiWidget.cpp:578
void ScriptPlayAnimationStop(const char *name)
Plays an animation.
Definition: UiWidget.cpp:278
void ScriptPlayAnimation(const char *name)
Plays an animation.
Definition: UiWidget.cpp:274
int ScriptAnimationSync()
Synchronizes an animation.
Definition: UiWidget.cpp:295
void ScriptSetWidth(float width)
Sets the absolute width of the widget.
Definition: UiWidget.cpp:584
void SetAlpha(const float a)
Sets the widget transparency.
Definition: UiWidget.cpp:570
float ScriptGetHeight()
Retrieves the absolute height of the widget.
Definition: UiWidget.cpp:589
void SetY(const float percent, const float y)
Sets the Y coordinate for the widget.
Definition: UiWidget.cpp:482
void SetColour(const float r, const float g, const float b)
Sets the widget colour.
Definition: UiWidget.cpp:551
void SetX(const float percent, const float x)
Sets the X coordinate for the widget.
Definition: UiWidget.cpp:471
The world map module.
Definition: WorldmapModule.h:26
void Init()
Initializes the world map module.
Definition: WorldmapModule.cpp:669
A walkmesh.
Definition: Walkmesh.h:68
bool IsLocked(unsigned int triangle_id) const
Checks if a triangle is locked.
Definition: Walkmesh.cpp:103
void LockWalkmesh(unsigned int triangle_id, bool lock)
Locks or unlocks a triangle.
Definition: Walkmesh.cpp:95
Handles XML map files.
Definition: XmlMapFile.h:23
void LoadMap()
Parses the file and loads the map data.
Definition: XmlMapFile.cpp:30
Handles the main maps file.
Definition: XmlMapsFile.h:24
const Ogre::String GetMapFileNameByName(const Ogre::String &name)
Retrieves a map file by map name.
Definition: XmlMapsFile.cpp:23
Ogre::String String
Definition: TypeDefine.h:37