xoreos  0.0.5
bindings.cpp
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
26 #include "glm/vec3.hpp"
27 
28 #include "src/common/error.h"
29 #include "src/common/util.h"
30 
32 #include "src/aurora/lua/stack.h"
33 #include "src/aurora/lua/util.h"
34 
36 
37 namespace Engines {
38 
39 namespace Witcher {
40 
41 static int pushFakeObject(lua_State &state, const Common::UString &type) {
42  static int fake = 1;
43 
44  Aurora::Lua::Stack stack(state);
45  stack.pushUserType<int>(fake, type);
46 
47  return 1;
48 }
49 
50 static void unimplementedFunction(const Common::UString &name, const Common::UString &type = "") {
51  if (type.empty()) {
52  warning("TODO: Unimplemented Lua function \"%s()\"", name.c_str());
53  } else {
54  warning("TODO: Unimplemented Lua function \"%s:%s()\"", type.c_str(), name.c_str());
55  }
56 }
57 
58 static void unimplementedVariable(const Common::UString &name, const Common::UString &type = "") {
59  if (type.empty()) {
60  warning("TODO: Unimplemented Lua variable \"%s\"", name.c_str());
61  } else {
62  warning("TODO: Unimplemented Lua variable \"%s.%s\"", type.c_str(), name.c_str());
63  }
64 }
65 
68 }
69 
71 
72 }
73 
109 
110  LuaScriptMan.beginRegister();
111 
112  LuaScriptMan.registerFunction("getAuroraSettings", &luaGetAuroraSettings);
113  LuaScriptMan.registerFunction("getCurrentCameraSettings", &luaGetCurrentCameraSettings);
114  LuaScriptMan.registerFunction("getGuiMan", &luaGetGUIMan);
115  LuaScriptMan.registerFunction("getClientPhysics", &luaGetClientPhysics);
116  LuaScriptMan.registerFunction("getAttackDefList", &luaGetAttackDefList);
117  LuaScriptMan.registerFunction("getRules", &luaGetRules);
118  LuaScriptMan.registerFunction("getClientExoApp", &luaGetClientExoApp);
119 
120  LuaScriptMan.registerFunction("isEditor", &luaIsEditor);
121  LuaScriptMan.registerFunction("isDebugBuild", &luaIsDebugBuild);
122  LuaScriptMan.registerFunction("isDemo", &luaIsDemo);
123  LuaScriptMan.registerFunction("isDjinni", &luaIsDjinni);
124 
125  LuaScriptMan.registerFunction("AurPrintf", &luaAurPrintf);
126  LuaScriptMan.registerFunction("console", &luaConsole);
127  LuaScriptMan.registerFunction("validnumber", &luaValidNumber);
128  LuaScriptMan.registerFunction("GuiAurAttachToObject", &luaGUIAurAttachToObject);
129 
130  LuaScriptMan.beginRegisterNamespace("wgs");
131  LuaScriptMan.registerFunction("getDefs", &luaGetDefs);
132  LuaScriptMan.endRegisterNamespace();
133 
134  LuaScriptMan.beginRegisterNamespace("bit");
135  LuaScriptMan.registerFunction("bor", &luaBor);
136  LuaScriptMan.endRegisterNamespace();
137 
138  LuaScriptMan.endRegister();
139 }
140 
141 int LuaBindings::luaGetAuroraSettings(lua_State *state) {
142  assert(state);
143 
144  unimplementedFunction("getAuroraSettings");
146 }
147 
149  assert(state);
150 
151  unimplementedFunction("getCurrentCameraSettings");
152  return pushFakeObject(*state, CCamera::getLuaType());
153 }
154 
155 int LuaBindings::luaGetGUIMan(lua_State *state) {
156  assert(state);
157 
158  unimplementedFunction("getGuiMan");
159  return pushFakeObject(*state, CGUIMan::getLuaType());
160 }
161 
162 int LuaBindings::luaGetClientPhysics(lua_State *state) {
163  assert(state);
164 
165  unimplementedFunction("getClientPhysics");
166  return pushFakeObject(*state, CPhysics::getLuaType());
167 }
168 
169 int LuaBindings::luaGetAttackDefList(lua_State *state) {
170  assert(state);
171 
172  unimplementedFunction("getAttackDefList");
173  return pushFakeObject(*state, CAttackDefList::getLuaType());
174 }
175 
176 int LuaBindings::luaGetRules(lua_State *state) {
177  assert(state);
178 
179  unimplementedFunction("getRules");
180  return pushFakeObject(*state, CRules::getLuaType());
181 }
182 
183 int LuaBindings::luaGetClientExoApp(lua_State *state) {
184  assert(state);
185 
186  unimplementedFunction("getClientExoApp");
187  return pushFakeObject(*state, CClientExoApp::getLuaType());
188 }
189 
190 int LuaBindings::luaGetDefs(lua_State *state) {
191  assert(state);
192 
193  unimplementedFunction("wgs.getDefs");
194  return pushFakeObject(*state, CDefs::getLuaType());
195 }
196 
197 int LuaBindings::luaIsEditor(lua_State *state) {
198  assert(state);
199 
200  unimplementedFunction("isEditor");
201 
202  Aurora::Lua::Stack stack(*state);
203  stack.pushBoolean(false);
204  return 1;
205 }
206 
207 int LuaBindings::luaIsDebugBuild(lua_State *state) {
208  assert(state);
209 
210  unimplementedFunction("isDebugBuild");
211 
212  Aurora::Lua::Stack stack(*state);
213  stack.pushBoolean(false);
214  return 1;
215 }
216 
217 int LuaBindings::luaIsDemo(lua_State *state) {
218  assert(state);
219 
220  unimplementedFunction("isDemo");
221 
222  Aurora::Lua::Stack stack(*state);
223  stack.pushBoolean(false);
224  return 1;
225 }
226 
227 int LuaBindings::luaIsDjinni(lua_State *state) {
228  assert(state);
229 
230  unimplementedFunction("isDjinni");
231 
232  Aurora::Lua::Stack stack(*state);
233  stack.pushBoolean(false);
234  return 1;
235 }
236 
237 int LuaBindings::luaAurPrintf(lua_State *UNUSED(state)) {
238  unimplementedFunction("AurPrintf");
239  return 0;
240 }
241 
242 int LuaBindings::luaConsole(lua_State *UNUSED(state)) {
243  unimplementedFunction("console");
244  return 0;
245 }
246 
247 int LuaBindings::luaValidNumber(lua_State *state) {
248  assert(state);
249 
250  unimplementedFunction("validnumber");
251 
252  Aurora::Lua::Stack stack(*state);
253  stack.pushBoolean(true);
254  return 1;
255 }
256 
258  unimplementedFunction("GuiAurAttachToObject");
259  return 0;
260 }
261 
262 int LuaBindings::luaBor(lua_State *state) {
263  assert(state);
264 
265  unimplementedFunction("bit.bor");
266 
267  Aurora::Lua::Stack stack(*state);
268  stack.pushInt(0);
269  return 1;
270 }
271 
273  LuaScriptMan.declareClass(getLuaType());
274 
275  LuaScriptMan.beginRegister();
276 
277  LuaScriptMan.beginRegisterClass(getLuaType());
278  LuaScriptMan.registerVariable("m_nDialogHorizontalOffset", &luaGetDialogHorizontalOffset);
279  LuaScriptMan.endRegisterClass();
280 
281  LuaScriptMan.endRegister();
282 }
283 
285  return "CAuroraSettings";
286 }
287 
289  assert(state);
290 
291  unimplementedVariable("m_nDialogHorizontalOffset", getLuaType());
292 
293  Aurora::Lua::Stack stack(*state);
294  stack.pushInt(1);
295  return 1;
296 }
297 
299  LuaScriptMan.declareClass(getLuaType());
300 
301  LuaScriptMan.beginRegister();
302 
303  LuaScriptMan.beginRegisterClass(getLuaType());
304  LuaScriptMan.registerFunction("Dist", &luaDist);
305  LuaScriptMan.registerFunction("Pitch", &luaPitch);
306  LuaScriptMan.registerFunction("FollowOffset", &luaFollowOffset);
307  LuaScriptMan.endRegisterClass();
308 
309  LuaScriptMan.endRegister();
310 }
311 
313  return "CCamera";
314 }
315 
316 int LuaBindings::CCamera::luaDist(lua_State *UNUSED(state)) {
317  unimplementedFunction("Dist", getLuaType());
318  return 0;
319 }
320 
321 int LuaBindings::CCamera::luaPitch(lua_State *UNUSED(state)) {
322  unimplementedFunction("Pitch", getLuaType());
323  return 0;
324 }
325 
327  unimplementedFunction("FollowOffset", getLuaType());
328  return 0;
329 }
330 
332  LuaScriptMan.declareClass(getLuaType());
333 
334  LuaScriptMan.beginRegister();
335 
336  LuaScriptMan.beginRegisterClass(getLuaType());
337  LuaScriptMan.registerFunction("CreateAurObject", &luaCreateAurObject);
338  LuaScriptMan.registerFunction("CreateAurObjectWithMesh", &luaCreateAurObjectWithMesh);
339  LuaScriptMan.endRegisterClass();
340 
341  LuaScriptMan.endRegister();
342 }
343 
345  return "CGuiMan";
346 }
347 
349  assert(state);
350 
351  unimplementedFunction("CreateAurObject", getLuaType());
352  return pushFakeObject(*state, CAurObject::getLuaType());
353 }
354 
356  assert(state);
357 
358  unimplementedFunction("CreateAurObjectWithMesh", getLuaType());
359  return pushFakeObject(*state, CAurObject::getLuaType());
360 }
361 
363  LuaScriptMan.declareClass(getLuaType());
364 
365  LuaScriptMan.beginRegister();
366 
367  LuaScriptMan.beginRegisterClass(getLuaType());
368  LuaScriptMan.endRegisterClass();
369 
370  LuaScriptMan.endRegister();
371 }
372 
374  return "CGuiInGame";
375 }
376 
378  LuaScriptMan.declareClass(getLuaType());
379 
380  LuaScriptMan.beginRegister();
381 
382  LuaScriptMan.beginRegisterClass(getLuaType());
383  LuaScriptMan.registerConstant("GUIOBJ_FLAG_MODALNEEDNOTBEONTOP", 0.0f);
384  LuaScriptMan.registerConstant("GUIOBJ_FLAG_IGNORE_MAKEMODALVISIBLE", 0.0f);
385  LuaScriptMan.endRegisterClass();
386 
387  LuaScriptMan.endRegister();
388 }
389 
391  return "CGuiObject";
392 }
393 
395  LuaScriptMan.declareClass(getLuaType());
396 
397  LuaScriptMan.beginRegister();
398 
399  LuaScriptMan.beginRegisterClass(getLuaType());
400  LuaScriptMan.registerFunction("new", &luaNew);
401  LuaScriptMan.endRegisterClass();
402 
403  LuaScriptMan.endRegister();
404 }
405 
407  return "CGuiControlBinds";
408 }
409 
411  assert(state);
412 
413  unimplementedFunction("new", getLuaType());
414  return pushFakeObject(*state, getLuaType());
415 }
416 
418  LuaScriptMan.declareClass(getLuaType());
419 
420  LuaScriptMan.beginRegister();
421 
422  LuaScriptMan.beginRegisterClass(getLuaType());
423  LuaScriptMan.registerFunction("new", &luaNew);
424  LuaScriptMan.registerFunction("SetModel", &luaSetModel);
425  LuaScriptMan.registerFunction("SetName", &luaSetName);
426  LuaScriptMan.registerFunction("Activate", &luaActivate);
427  LuaScriptMan.registerFunction("Deactivate", &luaDeactivate);
428  LuaScriptMan.registerFunction("RenderSceneViewFirst", &luaRenderSceneViewFirst);
429  LuaScriptMan.registerFunction("ToggleOff", &luaToggleOff);
430  LuaScriptMan.endRegisterClass();
431 
432  LuaScriptMan.endRegister();
433 }
434 
436  return "CGuiPanel";
437 }
438 
439 int LuaBindings::CGUIPanel::luaNew(lua_State *state) {
440  assert(state);
441 
442  unimplementedFunction("new", getLuaType());
443  return pushFakeObject(*state, getLuaType());
444 }
445 
447  unimplementedFunction("SetModel", getLuaType());
448  return 0;
449 }
450 
452  unimplementedFunction("SetName", getLuaType());
453  return 0;
454 }
455 
457  unimplementedFunction("Activate", getLuaType());
458  return 0;
459 }
460 
462  unimplementedFunction("Deactivate", getLuaType());
463  return 0;
464 }
465 
467  unimplementedFunction("RenderSceneViewFirst", getLuaType());
468  return 0;
469 }
470 
472  unimplementedFunction("ToggleOff", getLuaType());
473  return 0;
474 }
475 
477  LuaScriptMan.declareClass(getLuaType());
478 
479  LuaScriptMan.beginRegister();
480 
481  LuaScriptMan.beginRegisterClass(getLuaType(), CGUIPanel::getLuaType());
482  LuaScriptMan.endRegisterClass();
483 
484  LuaScriptMan.endRegister();
485 }
486 
488  return "CGuiModalPanel";
489 }
490 
492  LuaScriptMan.declareClass(getLuaType());
493 
494  LuaScriptMan.beginRegister();
495 
496  LuaScriptMan.beginRegisterClass(getLuaType());
497  LuaScriptMan.registerVariable("m_nFlags", &luaGetFlags, &luaSetFlags);
498  LuaScriptMan.registerFunction("CreateModel", &luaCreateModel);
499  LuaScriptMan.registerFunction("SetDebugName", &luaSetDebugName);
500  LuaScriptMan.registerFunction("AddTextLayer", &luaAddTextLayer);
501  LuaScriptMan.registerFunction("GetTextLabel", &luaGetTextLabel);
502  LuaScriptMan.registerFunction("IgnoreHitCheck", &luaIgnoreHitCheck);
503  LuaScriptMan.registerFunction("AddTextureLayer", &luaAddTextureLayer);
504  LuaScriptMan.registerFunction("AddTextureLayerTransformable", &luaAddTextureLayerTransformable);
505  LuaScriptMan.registerFunction("PlayAnimation", &luaPlayAnimation);
506  LuaScriptMan.registerFunction("SetAlignmentVertical", &luaSetAlignmentVertical);
507  LuaScriptMan.endRegisterClass();
508 
509  LuaScriptMan.endRegister();
510 }
511 
513  return "CGuiNewControl";
514 }
515 
517  unimplementedFunction("CreateModel", getLuaType());
518  return 0;
519 }
520 
522  unimplementedFunction("SetDebugName", getLuaType());
523  return 0;
524 }
525 
527  unimplementedFunction("AddTextLayer", getLuaType());
528  return 0;
529 }
530 
532  assert(state);
533 
534  unimplementedVariable("m_nFlags", getLuaType());
535 
536  Aurora::Lua::Stack stack(*state);
537  stack.pushInt(0);
538  return 1;
539 }
540 
542  unimplementedVariable("m_nFlags", getLuaType());
543  return 0;
544 }
545 
547  assert(state);
548 
549  unimplementedFunction("GetTextLabel", getLuaType());
550  return pushFakeObject(*state, getLuaType());
551 }
552 
554  unimplementedFunction("IgnoreHitCheck", getLuaType());
555  return 0;
556 }
557 
559  unimplementedFunction("AddTextureLayer", getLuaType());
560  return 0;
561 }
562 
564  unimplementedFunction("AddTextureLayerTransformable", getLuaType());
565  return 0;
566 }
567 
569  unimplementedFunction("PlayAnimation", getLuaType());
570  return 0;
571 }
572 
574  unimplementedFunction("SetAlignmentVertical", getLuaType());
575  return 0;
576 }
577 
579  LuaScriptMan.declareClass(getLuaType());
580 
581  LuaScriptMan.beginRegister();
582 
583  LuaScriptMan.beginRegisterClass(getLuaType());
584  LuaScriptMan.registerFunction("SetEnableCamera", &luaSetEnableCamera);
585  LuaScriptMan.endRegisterClass();
586 
587  LuaScriptMan.endRegister();
588 }
589 
591  return "CPhysics";
592 }
593 
595  unimplementedFunction("SetEnableCamera", getLuaType());
596  return 0;
597 }
598 
600  LuaScriptMan.declareClass(getLuaType());
601 
602  LuaScriptMan.beginRegister();
603 
604  LuaScriptMan.beginRegisterClass(getLuaType());
605  LuaScriptMan.registerFunction("GetTlkTable", &luaGetTlkTable);
606  LuaScriptMan.endRegisterClass();
607 
608  LuaScriptMan.endRegister();
609 }
610 
612  return "CTlkTable";
613 }
614 
616  assert(state);
617 
618  unimplementedFunction("GetTlkTable", getLuaType());
619  return pushFakeObject(*state, getLuaType());
620 }
621 
623  LuaScriptMan.declareClass(getLuaType());
624 
625  LuaScriptMan.beginRegister();
626 
627  LuaScriptMan.beginRegisterClass(getLuaType());
628  LuaScriptMan.registerFunction("Clear", &luaClear);
629  LuaScriptMan.endRegisterClass();
630 
631  LuaScriptMan.endRegister();
632 }
633 
635  return "CAttackDefList";
636 }
637 
639  unimplementedFunction("Clear", getLuaType());
640  return 0;
641 }
642 
644  LuaScriptMan.declareClass(getLuaType());
645 
646  LuaScriptMan.beginRegister();
647 
648  LuaScriptMan.beginRegisterClass(getLuaType());
649  LuaScriptMan.registerFunction("GetFontMgr", &luaGetFontMgr);
650  LuaScriptMan.registerFunction("AddResolution", &luaAddResolution);
651  LuaScriptMan.registerFunction("LoadFont", &luaLoadFont);
652  LuaScriptMan.endRegisterClass();
653 
654  LuaScriptMan.endRegister();
655 }
656 
658  return "CFontMgr";
659 }
660 
662  assert(state);
663 
664  unimplementedFunction("GetFontMgr", getLuaType());
665  return pushFakeObject(*state, getLuaType());
666 }
667 
669  unimplementedFunction("AddResolution", getLuaType());
670  return 0;
671 }
672 
674  unimplementedFunction("LoadFont", getLuaType());
675  return 0;
676 }
677 
679  LuaScriptMan.declareClass(getLuaType());
680 
681  LuaScriptMan.beginRegister();
682 
683  LuaScriptMan.beginRegisterClass(getLuaType());
684  LuaScriptMan.registerFunction("Get2DArrays", &luaGet2DArrays);
685  LuaScriptMan.endRegisterClass();
686 
687  LuaScriptMan.endRegister();
688 }
689 
691  return "CRules";
692 }
693 
694 int LuaBindings::CRules::luaGet2DArrays(lua_State *state) {
695  assert(state);
696 
697  unimplementedFunction("Get2DArrays", getLuaType());
698  return pushFakeObject(*state, C2DArrays::getLuaType());
699 }
700 
702  LuaScriptMan.declareClass(getLuaType());
703 
704  LuaScriptMan.beginRegister();
705  LuaScriptMan.beginRegisterNamespace("wgs");
706 
707  LuaScriptMan.beginRegisterClass(getLuaType());
708  LuaScriptMan.registerFunction("Clear", &luaClear);
709  LuaScriptMan.registerFunction("AddGameEffectType", &luaAddGameEffectType);
710  LuaScriptMan.registerFunction("AddGameEffectMedium", &luaAddGameEffectMedium);
711  LuaScriptMan.registerFunction("AddWeaponType", &luaAddWeaponType);
712  LuaScriptMan.registerFunction("AddSpellType", &luaAddSpellType);
713  LuaScriptMan.registerFunction("AddAbility", &luaAddAbility);
714  LuaScriptMan.endRegisterClass();
715 
716  LuaScriptMan.endRegisterNamespace();
717  LuaScriptMan.endRegister();
718 }
719 
721  return "CDefs";
722 }
723 
724 int LuaBindings::CDefs::luaClear(lua_State *UNUSED(state)) {
725  unimplementedFunction("Clear", getLuaType());
726  return 0;
727 }
728 
730  unimplementedFunction("AddGameEffectType", getLuaType());
731  return 0;
732 }
733 
735  unimplementedFunction("AddGameEffectMedium", getLuaType());
736  return 0;
737 }
738 
740  unimplementedFunction("AddWeaponType", getLuaType());
741  return 0;
742 }
743 
745  unimplementedFunction("AddSpellType", getLuaType());
746  return 0;
747 }
748 
749 int LuaBindings::CDefs::luaAddAbility(lua_State *state) {
750  assert(state);
751 
752  unimplementedFunction("AddAbility", getLuaType());
753  return pushFakeObject(*state, CAbility::getLuaType());
754 }
755 
757  LuaScriptMan.declareClass(getLuaType());
758 
759  LuaScriptMan.beginRegister();
760  LuaScriptMan.beginRegisterNamespace("wgs");
761 
762  LuaScriptMan.beginRegisterClass(getLuaType());
763  LuaScriptMan.registerFunction(".get", &luaGet);
764  LuaScriptMan.endRegisterClass();
765 
766  LuaScriptMan.endRegisterNamespace();
767  LuaScriptMan.endRegister();
768 }
769 
771  return "CAttrs";
772 }
773 
774 int LuaBindings::CAttrs::luaGet(lua_State *UNUSED(state)) {
775  unimplementedFunction(".Get", getLuaType());
776  return 0;
777 }
778 
780  LuaScriptMan.declareClass(getLuaType());
781 
782  LuaScriptMan.beginRegister();
783 
784  LuaScriptMan.beginRegisterClass(getLuaType());
785  LuaScriptMan.registerFunction("GetLanguagesTable", &luaGetLanguagesTable);
786  LuaScriptMan.endRegisterClass();
787 
788  LuaScriptMan.endRegister();
789 }
790 
792  return "C2DArrays";
793 }
794 
796  assert(state);
797 
798  unimplementedFunction("GetLanguagesTable", getLuaType());
799  return pushFakeObject(*state, C2DA::getLuaType());
800 }
801 
803  LuaScriptMan.declareClass(getLuaType());
804 
805  LuaScriptMan.beginRegister();
806 
807  LuaScriptMan.beginRegisterClass(getLuaType());
808  LuaScriptMan.registerFunction("new", &luaNew);
809  LuaScriptMan.registerFunction("delete", &luaDelete);
810  LuaScriptMan.registerFunction("new_local", &luaNewLocal);
811  LuaScriptMan.registerFunction("Load2DArray", &luaLoad2DArray);
812  LuaScriptMan.registerFunction("Unload2DArray", &luaUnload2DArray);
813  LuaScriptMan.registerFunction("GetNumRows", &luaGetNumRows);
814  LuaScriptMan.registerFunction("GetCExoStringEntry", &luaGetCExoStringEntry);
815  LuaScriptMan.registerFunction("GetINTEntry", &luaGetIntEntry);
816  LuaScriptMan.endRegisterClass();
817 
818  LuaScriptMan.endRegister();
819 }
820 
822  return "C2DA";
823 }
824 
825 int LuaBindings::C2DA::luaNew(lua_State *state) {
826  assert(state);
827 
828  unimplementedFunction("new", getLuaType());
829  return pushFakeObject(*state, getLuaType());
830 }
831 
832 int LuaBindings::C2DA::luaDelete(lua_State *UNUSED(state)) {
833  unimplementedFunction("delete", getLuaType());
834  return 0;
835 }
836 
837 int LuaBindings::C2DA::luaNewLocal(lua_State *state) {
838  assert(state);
839 
840  unimplementedFunction("new_local", getLuaType());
841  return pushFakeObject(*state, getLuaType());
842 }
843 
845  unimplementedFunction("Load2DArray", getLuaType());
846  return 0;
847 }
848 
850  unimplementedFunction("Unload2DArray", getLuaType());
851  return 0;
852 }
853 
854 int LuaBindings::C2DA::luaGetNumRows(lua_State *state) {
855  assert(state);
856 
857  unimplementedFunction("GetNumRows", getLuaType());
858 
859  Aurora::Lua::Stack stack(*state);
860  stack.pushInt(1);
861  return 1;
862 }
863 
865  assert(state);
866 
867  unimplementedFunction("GetCExoStringEntry", getLuaType());
868 
869  Aurora::Lua::Stack stack(*state);
870  stack.pushNil();
871  stack.pushNil();
872  stack.pushString("");
873  return 3;
874 }
875 
876 int LuaBindings::C2DA::luaGetIntEntry(lua_State *state) {
877  assert(state);
878 
879  unimplementedFunction("GetINTEntry", getLuaType());
880 
881  Aurora::Lua::Stack stack(*state);
882  stack.pushNil();
883  stack.pushNil();
884  stack.pushInt(0);
885  return 3;
886 }
887 
889  LuaScriptMan.declareClass(getLuaType());
890 
891  LuaScriptMan.beginRegister();
892 
893  LuaScriptMan.beginRegisterClass(getLuaType());
894  LuaScriptMan.registerFunction("GetClientTextLanguage", &luaGetClientTextLanguage);
895  LuaScriptMan.endRegisterClass();
896 
897  LuaScriptMan.endRegister();
898 }
899 
901  return "CClientExoApp";
902 }
903 
905  assert(state);
906 
907  unimplementedFunction("GetClientTextLanguage", getLuaType());
908 
909  Aurora::Lua::Stack stack(*state);
910  stack.pushInt(1);
911  return 1;
912 }
913 
915  LuaScriptMan.declareClass(getLuaType());
916 
917  LuaScriptMan.beginRegister();
918 
919  LuaScriptMan.beginRegisterClass(getLuaType());
920  LuaScriptMan.endRegisterClass();
921 
922  LuaScriptMan.endRegister();
923 }
924 
926  return "CNWCModule";
927 }
928 
930  LuaScriptMan.declareClass(getLuaType());
931 
932  LuaScriptMan.beginRegister();
933 
934  LuaScriptMan.beginRegisterClass(getLuaType());
935  LuaScriptMan.endRegisterClass();
936 
937  LuaScriptMan.endRegister();
938 }
939 
941  return "CNWCCreature";
942 }
943 
945  LuaScriptMan.declareClass(getLuaType());
946 
947  LuaScriptMan.beginRegister();
948 
949  LuaScriptMan.beginRegisterClass(getLuaType());
950  LuaScriptMan.endRegisterClass();
951 
952  LuaScriptMan.endRegister();
953 }
954 
956  return "CAurObject";
957 }
958 
960  LuaScriptMan.declareClass(getLuaType());
961 
962  LuaScriptMan.beginRegister();
963  LuaScriptMan.beginRegisterNamespace("wgs");
964 
965  LuaScriptMan.beginRegisterClass(getLuaType());
966  LuaScriptMan.endRegisterClass();
967 
968  LuaScriptMan.endRegisterNamespace();
969  LuaScriptMan.endRegister();
970 }
971 
973  return "CEffectDuration";
974 }
975 
977  LuaScriptMan.declareClass(getLuaType());
978 
979  LuaScriptMan.beginRegister();
980  LuaScriptMan.beginRegisterNamespace("wgs");
981 
982  LuaScriptMan.beginRegisterClass(getLuaType());
983  LuaScriptMan.endRegisterClass();
984 
985  LuaScriptMan.endRegisterNamespace();
986  LuaScriptMan.endRegister();
987 }
988 
990  return "CAbility";
991 }
992 
994  LuaScriptMan.declareClass(getLuaType());
995 
996  LuaScriptMan.beginRegister();
997  LuaScriptMan.beginRegisterNamespace("wgs");
998 
999  LuaScriptMan.beginRegisterClass(getLuaType());
1000  LuaScriptMan.endRegisterClass();
1001 
1002  LuaScriptMan.endRegisterNamespace();
1003  LuaScriptMan.endRegister();
1004 }
1005 
1007  return "CAbilityCondition";
1008 }
1009 
1011  LuaScriptMan.declareClass(getLuaType());
1012 
1013  LuaScriptMan.beginRegister();
1014 
1015  LuaScriptMan.beginRegisterClass(getLuaType());
1016  LuaScriptMan.endRegisterClass();
1017 
1018  LuaScriptMan.endRegister();
1019 }
1020 
1022  return "CWeatherRain";
1023 }
1024 
1026  LuaScriptMan.declareClass(getLuaType());
1027 
1028  LuaScriptMan.beginRegister();
1029 
1030  LuaScriptMan.beginRegisterClass(getLuaType());
1031  LuaScriptMan.endRegisterClass();
1032 
1033  LuaScriptMan.endRegister();
1034 }
1035 
1037  return "CWeatherFog";
1038 }
1039 
1041  LuaScriptMan.declareClass(getLuaType());
1042 
1043  LuaScriptMan.beginRegister();
1044 
1045  LuaScriptMan.beginRegisterClass(getLuaType());
1046  LuaScriptMan.endRegisterClass();
1047 
1048  LuaScriptMan.endRegister();
1049 }
1050 
1052  return "CAurFullScreenFXMgr";
1053 }
1054 
1056  LuaScriptMan.declareClass(getLuaType());
1057 
1058  LuaScriptMan.beginRegister();
1059 
1060  LuaScriptMan.beginRegisterClass(getLuaType());
1061  LuaScriptMan.registerFunction("new_local", &luaNewLocal);
1062  LuaScriptMan.registerFunction("SetVolume", &luaSetVolume);
1063  LuaScriptMan.registerFunction("SetLooping", &luaSetLooping);
1064  LuaScriptMan.endRegisterClass();
1065 
1066  LuaScriptMan.endRegister();
1067 }
1068 
1070  return "CExoSoundSource";
1071 }
1072 
1074  assert(state);
1075 
1076  unimplementedFunction("new_local", getLuaType());
1077  return pushFakeObject(*state, getLuaType());
1078 }
1079 
1081  unimplementedFunction("SetVolume", getLuaType());
1082  return 0;
1083 }
1084 
1086  unimplementedFunction("SetLooping", getLuaType());
1087  return 0;
1088 }
1089 
1091  LuaScriptMan.declareClass(getLuaType());
1092 
1093  LuaScriptMan.beginRegister();
1094 
1095  LuaScriptMan.beginRegisterClass(getLuaType());
1096  LuaScriptMan.endRegisterClass();
1097 
1098  LuaScriptMan.endRegister();
1099 }
1100 
1102  return "CMiniGamesInterface";
1103 }
1104 
1106  LuaScriptMan.declareClass(getLuaType());
1107 
1108  LuaScriptMan.beginRegister();
1109 
1110  LuaScriptMan.beginRegisterClass(getLuaType());
1111  LuaScriptMan.endRegisterClass();
1112 
1113  LuaScriptMan.endRegister();
1114 }
1115 
1117  return "LuaScriptedTextureController";
1118 }
1119 
1121  LuaScriptMan.declareClass(getLuaType());
1122 
1123  LuaScriptMan.beginRegister();
1124 
1125  LuaScriptMan.beginRegisterClass(getLuaType());
1126  LuaScriptMan.registerFunction("new_local", &luaNewLocal);
1127  LuaScriptMan.endRegisterClass();
1128 
1129  LuaScriptMan.endRegister();
1130 }
1131 
1133  return "Quaternion";
1134 }
1135 
1137  assert(state);
1138 
1139  unimplementedFunction("new_local", getLuaType());
1140  return pushFakeObject(*state, getLuaType());
1141 }
1142 
1144  LuaScriptMan.declareClass(getLuaType());
1145 
1146  LuaScriptMan.beginRegister();
1147 
1148  LuaScriptMan.beginRegisterClass(getLuaType(), "", LUA_DEFAULT_DELETER(glm::vec3));
1149  LuaScriptMan.registerVariable("x", &luaGetX, &luaSetX);
1150  LuaScriptMan.registerVariable("y", &luaGetY, &luaSetY);
1151  LuaScriptMan.registerVariable("z", &luaGetZ, &luaSetZ);
1152  LuaScriptMan.registerFunction("new_local", &luaNewLocal);
1153  LuaScriptMan.registerFunction("Set", &luaSet);
1154  LuaScriptMan.endRegisterClass();
1155 
1156  LuaScriptMan.endRegister();
1157 }
1158 
1160  return "Vector";
1161 }
1162 
1163 int LuaBindings::Vector::luaNewLocal(lua_State *state) {
1164  assert(state);
1165 
1166  Aurora::Lua::Stack stack(*state);
1167  assert(stack.getSize() == 1 || stack.getSize() == 4);
1168 
1169  glm::vec3* v = new glm::vec3;
1170  if (stack.getSize() == 4) {
1171  v->x = stack.getFloatAt(2);
1172  v->y = stack.getFloatAt(3);
1173  v->z = stack.getFloatAt(4);
1174  }
1175 
1176  stack.pushUserType<glm::vec3>(*v, getLuaType());
1177  stack.registerGCForTopObject();
1178  return 1;
1179 }
1180 
1181 int LuaBindings::Vector::luaSet(lua_State *state) {
1182  assert(state);
1183 
1184  Aurora::Lua::Stack stack(*state);
1185  assert(stack.getSize() == 4);
1186 
1187  glm::vec3* v = Aurora::Lua::getCppObjectFromStack<glm::vec3>(stack, 1);
1188  assert(v);
1189 
1190  v->x = stack.getFloatAt(2);
1191  v->y = stack.getFloatAt(3);
1192  v->z = stack.getFloatAt(4);
1193  return 0;
1194 }
1195 
1196 int LuaBindings::Vector::luaGetX(lua_State *state) {
1197  assert(state);
1198 
1199  Aurora::Lua::Stack stack(*state);
1200  assert(stack.getSize() == 2);
1201 
1202  glm::vec3* v = Aurora::Lua::getCppObjectFromStack<glm::vec3>(stack, 1);
1203  assert(v);
1204 
1205  stack.pushFloat(v->x);
1206  return 1;
1207 }
1208 
1209 int LuaBindings::Vector::luaSetX(lua_State *state) {
1210  assert(state);
1211 
1212  Aurora::Lua::Stack stack(*state);
1213  assert(stack.getSize() == 2);
1214 
1215  glm::vec3* v = Aurora::Lua::getCppObjectFromStack<glm::vec3>(stack, 1);
1216  assert(v);
1217 
1218  v->x = stack.getFloatAt(2);
1219  return 0;
1220 }
1221 
1222 int LuaBindings::Vector::luaGetY(lua_State *state) {
1223  assert(state);
1224 
1225  Aurora::Lua::Stack stack(*state);
1226  assert(stack.getSize() == 2);
1227 
1228  glm::vec3* v = Aurora::Lua::getCppObjectFromStack<glm::vec3>(stack, 1);
1229  assert(v);
1230 
1231  stack.pushFloat(v->y);
1232  return 1;
1233 }
1234 
1235 int LuaBindings::Vector::luaSetY(lua_State *state) {
1236  assert(state);
1237 
1238  Aurora::Lua::Stack stack(*state);
1239  assert(stack.getSize() == 2);
1240 
1241  glm::vec3* v = Aurora::Lua::getCppObjectFromStack<glm::vec3>(stack, 1);
1242  assert(v);
1243 
1244  v->y = stack.getFloatAt(2);
1245  return 0;
1246 }
1247 
1248 int LuaBindings::Vector::luaGetZ(lua_State *state) {
1249  assert(state);
1250 
1251  Aurora::Lua::Stack stack(*state);
1252  assert(stack.getSize() == 2);
1253 
1254  glm::vec3* v = Aurora::Lua::getCppObjectFromStack<glm::vec3>(stack, 1);
1255  assert(v);
1256 
1257  stack.pushFloat(v->z);
1258  return 1;
1259 }
1260 
1261 int LuaBindings::Vector::luaSetZ(lua_State *state) {
1262  assert(state);
1263 
1264  Aurora::Lua::Stack stack(*state);
1265  assert(stack.getSize() == 2);
1266 
1267  glm::vec3* v = Aurora::Lua::getCppObjectFromStack<glm::vec3>(stack, 1);
1268  assert(v);
1269 
1270  v->z = stack.getFloatAt(2);
1271  return 0;
1272 }
1273 
1275  LuaScriptMan.declareClass(getLuaType());
1276 
1277  LuaScriptMan.beginRegister();
1278 
1279  LuaScriptMan.beginRegisterClass(getLuaType());
1280  LuaScriptMan.registerFunction("GetActualGuiWidth", &luaGetActualGUIWidth);
1281  LuaScriptMan.endRegisterClass();
1282 
1283  LuaScriptMan.endRegister();
1284 }
1285 
1287  return "ScreenSizes";
1288 }
1289 
1291  assert(state);
1292 
1293  unimplementedFunction("GetActualGuiWidth", getLuaType());
1294 
1295  Aurora::Lua::Stack stack(*state);
1296  stack.pushInt(1);
1297  return 1;
1298 }
1299 
1300 } // End of namespace Witcher
1301 
1302 } // End of namespace Engines
static Common::UString getLuaType()
Definition: bindings.cpp:435
static int luaNew(lua_State *state)
Definition: bindings.cpp:825
static int luaSetEnableCamera(lua_State *state)
Definition: bindings.cpp:594
static int luaGetTextLabel(lua_State *state)
Definition: bindings.cpp:546
static Common::UString getLuaType()
Definition: bindings.cpp:821
static Common::UString getLuaType()
Definition: bindings.cpp:390
static int luaSetX(lua_State *state)
Definition: bindings.cpp:1209
static Common::UString getLuaType()
Definition: bindings.cpp:791
static int luaLoadFont(lua_State *state)
Definition: bindings.cpp:673
A class holding an UTF-8 string.
Definition: ustring.h:48
static int luaValidNumber(lua_State *state)
Definition: bindings.cpp:247
static int luaIsEditor(lua_State *state)
Definition: bindings.cpp:197
static int luaIgnoreHitCheck(lua_State *state)
Definition: bindings.cpp:553
static int luaBor(lua_State *state)
Definition: bindings.cpp:262
static int luaDist(lua_State *state)
Definition: bindings.cpp:316
static int luaDeactivate(lua_State *state)
Definition: bindings.cpp:461
void pushInt(int value)
Push an integer value onto the stack.
Definition: stack.cpp:64
static int luaGetActualGUIWidth(lua_State *state)
Definition: bindings.cpp:1290
static int luaSetAlignmentVertical(lua_State *state)
Definition: bindings.cpp:573
static int luaAddGameEffectMedium(lua_State *state)
Definition: bindings.cpp:734
static Common::UString getLuaType()
Definition: bindings.cpp:312
static int luaGetNumRows(lua_State *state)
Definition: bindings.cpp:854
static Common::UString getLuaType()
Definition: bindings.cpp:657
int getSize() const
Return the number of elements in the stack.
Definition: stack.cpp:48
static int luaActivate(lua_State *state)
Definition: bindings.cpp:456
static int luaFollowOffset(lua_State *state)
Definition: bindings.cpp:326
static int luaAddTextureLayerTransformable(lua_State *state)
Definition: bindings.cpp:563
static int luaGetFlags(lua_State *state)
Definition: bindings.cpp:531
static int luaSetY(lua_State *state)
Definition: bindings.cpp:1235
static Common::UString getLuaType()
Definition: bindings.cpp:373
static int luaNewLocal(lua_State *state)
Definition: bindings.cpp:1073
static int luaAddAbility(lua_State *state)
Definition: bindings.cpp:749
static int luaClear(lua_State *state)
Definition: bindings.cpp:638
static int luaIsDjinni(lua_State *state)
Definition: bindings.cpp:227
void pushUserType(T &value, const Common::UString &type)
Push a usertype value onto the stack.
Definition: stack.h:138
static Common::UString getLuaType()
Definition: bindings.cpp:989
static int luaGetGUIMan(lua_State *state)
Definition: bindings.cpp:155
static int luaAddTextLayer(lua_State *state)
Definition: bindings.cpp:526
static Common::UString getLuaType()
Definition: bindings.cpp:1159
static int luaClear(lua_State *state)
Definition: bindings.cpp:724
static int luaNewLocal(lua_State *state)
Definition: bindings.cpp:837
static int luaAddWeaponType(lua_State *state)
Definition: bindings.cpp:739
static Common::UString getLuaType()
Definition: bindings.cpp:770
static int luaGet2DArrays(lua_State *state)
Definition: bindings.cpp:694
static int luaSetDebugName(lua_State *state)
Definition: bindings.cpp:521
static int luaGetAuroraSettings(lua_State *state)
Definition: bindings.cpp:141
static int luaAddSpellType(lua_State *state)
Definition: bindings.cpp:744
static int luaGetY(lua_State *state)
Definition: bindings.cpp:1222
static int luaAddGameEffectType(lua_State *state)
Definition: bindings.cpp:729
static int luaGet(lua_State *state)
Definition: bindings.cpp:774
static Common::UString getLuaType()
Definition: bindings.cpp:690
Basic exceptions to throw.
static int luaGetZ(lua_State *state)
Definition: bindings.cpp:1248
const char * c_str() const
Return the (utf8 encoded) string data.
Definition: ustring.cpp:249
void registerGCForTopObject()
Definition: stack.cpp:296
#define UNUSED(x)
Definition: system.h:170
Utility templates and functions.
static int luaNewLocal(lua_State *state)
Definition: bindings.cpp:1163
static int luaSetName(lua_State *state)
Definition: bindings.cpp:451
static int luaGetCurrentCameraSettings(lua_State *state)
Definition: bindings.cpp:148
static Common::UString getLuaType()
Definition: bindings.cpp:590
static int luaGetClientExoApp(lua_State *state)
Definition: bindings.cpp:183
static int luaUnload2DArray(lua_State *state)
Definition: bindings.cpp:849
static int luaSetZ(lua_State *state)
Definition: bindings.cpp:1261
#define LUA_DEFAULT_DELETER(Type)
Definition: util.h:70
static int luaIsDebugBuild(lua_State *state)
Definition: bindings.cpp:207
static int luaNew(lua_State *state)
Definition: bindings.cpp:439
static int luaIsDemo(lua_State *state)
Definition: bindings.cpp:217
static int luaCreateModel(lua_State *state)
Definition: bindings.cpp:516
static int luaDelete(lua_State *state)
Definition: bindings.cpp:832
A Lua stack wrapper.
Definition: stack.h:41
static int luaSetFlags(lua_State *state)
Definition: bindings.cpp:541
static int luaGetAttackDefList(lua_State *state)
Definition: bindings.cpp:169
void warning(const char *s,...)
Definition: util.cpp:33
static int luaCreateAurObject(lua_State *state)
Definition: bindings.cpp:348
static int luaAddTextureLayer(lua_State *state)
Definition: bindings.cpp:558
static int luaNewLocal(lua_State *state)
Definition: bindings.cpp:1136
static int luaCreateAurObjectWithMesh(lua_State *state)
Definition: bindings.cpp:355
static Common::UString getLuaType()
Definition: bindings.cpp:611
static int pushFakeObject(lua_State &state, const Common::UString &type)
Definition: bindings.cpp:41
void pushBoolean(bool value)
Push a boolean value onto the stack.
Definition: stack.cpp:56
static int luaGetIntEntry(lua_State *state)
Definition: bindings.cpp:876
static int luaGetClientTextLanguage(lua_State *state)
Definition: bindings.cpp:904
static int luaPitch(lua_State *state)
Definition: bindings.cpp:321
static int luaSetLooping(lua_State *state)
Definition: bindings.cpp:1085
static int luaAddResolution(lua_State *state)
Definition: bindings.cpp:668
static int luaGUIAurAttachToObject(lua_State *state)
Definition: bindings.cpp:257
void pushNil()
Push a nil value onto the stack.
Definition: stack.cpp:52
static int luaLoad2DArray(lua_State *state)
Definition: bindings.cpp:844
static int luaGetClientPhysics(lua_State *state)
Definition: bindings.cpp:162
static int luaSetModel(lua_State *state)
Definition: bindings.cpp:446
static int luaSetVolume(lua_State *state)
Definition: bindings.cpp:1080
static void unimplementedVariable(const Common::UString &name, const Common::UString &type="")
Definition: bindings.cpp:58
Lua script manager.
static int luaAurPrintf(lua_State *state)
Definition: bindings.cpp:237
static int luaGetTlkTable(lua_State *state)
Definition: bindings.cpp:615
static int luaGetCExoStringEntry(lua_State *state)
Definition: bindings.cpp:864
static int luaSet(lua_State *state)
Definition: bindings.cpp:1181
static int luaGetRules(lua_State *state)
Definition: bindings.cpp:176
static Common::UString getLuaType()
Definition: bindings.cpp:720
static Common::UString getLuaType()
Definition: bindings.cpp:955
static int luaGetDefs(lua_State *state)
Definition: bindings.cpp:190
static int luaToggleOff(lua_State *state)
Definition: bindings.cpp:471
static int luaGetDialogHorizontalOffset(lua_State *state)
Definition: bindings.cpp:288
float getFloatAt(int index) const
Return a float value at the given index in the stack.
Definition: stack.cpp:141
Lua helpers.
#define LuaScriptMan
Shortcut for accessing the script engine.
Definition: scriptman.h:157
static int luaGetLanguagesTable(lua_State *state)
Definition: bindings.cpp:795
static int luaConsole(lua_State *state)
Definition: bindings.cpp:242
A Lua stack wrapper.
static Common::UString getLuaType()
Definition: bindings.cpp:344
static int luaGetX(lua_State *state)
Definition: bindings.cpp:1196
The Lua bindings for The Witcher.
static int luaGetFontMgr(lua_State *state)
Definition: bindings.cpp:661
static void unimplementedFunction(const Common::UString &name, const Common::UString &type="")
Definition: bindings.cpp:50
static int luaRenderSceneViewFirst(lua_State *state)
Definition: bindings.cpp:466
static Common::UString getLuaType()
Definition: bindings.cpp:925
static Common::UString getLuaType()
Definition: bindings.cpp:1132
void pushString(const char *value)
Push a raw C string onto the stack.
Definition: stack.cpp:68
static int luaPlayAnimation(lua_State *state)
Definition: bindings.cpp:568