aboutsummaryrefslogtreecommitdiff
path: root/src/script/common/c_converter.h
blob: 3b7eb6f7d2f8a1db4bc22bd8aa69d56de48905a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


/******************************************************************************/
/******************************************************************************/
/* WARNING!!!! do NOT add this header in any include file or any code file    */
/*             not being a script/modapi file!!!!!!!!                         */
/******************************************************************************/
/******************************************************************************/
#ifndef C_CONVERTER_H_
#define C_CONVERTER_H_

#include <vector>
#include <map>

#include "irrlichttypes_bloated.h"
#include "common/c_types.h"

extern "C" {
#include <lua.h>
}

std::string        getstringfield_default(lua_State *L, int table,
                             const char *fieldname, const std::string &default_);
bool               getboolfield_default(lua_State *L, int table,
                             const char *fieldname, bool default_);
float              getfloatfield_default(lua_State *L, int table,
                             const char *fieldname, float default_);
int                getintfield_default           (lua_State *L, int table,
                             const char *fieldname, int default_);

bool               getstringfield(lua_State *L, int table,
                             const char *fieldname, std::string &result);
bool               getstringlistfield(lua_State *L, int table,
                             const char *fieldname,
                             std::vector<const char *> &result);
bool               getintfield(lua_State *L, int table,
                             const char *fieldname, int &result);
void               read_groups(lua_State *L, int index,
                             std::map<std::string, int> &result);
bool               getboolfield(lua_State *L, int table,
                             const char *fieldname, bool &result);
bool               getfloatfield(lua_State *L, int table,
                             const char *fieldname, float &result);

std::string        checkstringfield(lua_State *L, int table,
                             const char *fieldname);

void               setintfield(lua_State *L, int table,
                             const char *fieldname, int value);
void               setfloatfield(lua_State *L, int table,
                             const char *fieldname, float value);
void               setboolfield(lua_State *L, int table,
                             const char *fieldname, bool value);


v3f                 checkFloatPos       (lua_State *L, int index);
v3f                 check_v3f           (lua_State *L, int index);
v3s16               check_v3s16         (lua_State *L, int index);

v3f                 read_v3f            (lua_State *L, int index);
v2f                 read_v2f            (lua_State *L, int index);
v2s16               read_v2s16          (lua_State *L, int index);
v2s32               read_v2s32          (lua_State *L, int index);
video::SColor       readARGB8           (lua_State *L, int index);
aabb3f              read_aabb3f         (lua_State *L, int index, f32 scale);
v3s16               read_v3s16          (lua_State *L, int index);
std::vector<aabb3f> read_aabb3f_vector  (lua_State *L, int index, f32 scale);
bool                read_stringlist     (lua_State *L, int index,
                                         std::vector<const char *> &result);

void                push_v3s16          (lua_State *L, v3s16 p);
void                pushFloatPos        (lua_State *L, v3f p);
void                push_v3f            (lua_State *L, v3f p);
void                push_v2f            (lua_State *L, v2f p);



void                warn_if_field_exists      (lua_State *L,
                                              int table,
                                              const char *fieldname,
                                              const std::string &message);

#endif /* C_CONVERTER_H_ */
0.142905 -0.818151 v 0.818151 0.142905 0.230056 v 0.733298 0.185325 0.314908 v -0.314908 0.185325 -0.733298 v 0.314908 0.394489 0.733298 v -0.733298 0.394489 -0.314908 v -0.818151 0.436909 -0.230056 v 0.230055 0.436909 0.818151 v 0.314908 0.344489 0.733298 v -0.733298 0.344489 -0.314908 v -0.818151 0.386909 -0.230055 v 0.230055 0.386909 0.818151 v -0.391264 0.173498 -0.656942 v 0.656941 0.173498 0.391265 v 0.572089 0.215918 0.476118 v -0.476117 0.215918 -0.572089 v -0.391264 0.223498 -0.656941 v 0.656942 0.223498 0.391265 v 0.572088 0.265918 0.476117 v -0.476117 0.265918 -0.572089 v -0.354093 0.278660 -0.111416 v -0.354093 0.442721 -0.111416 v -0.111416 0.157340 -0.354093 v -0.111416 0.321400 -0.354093 v -0.448220 0.278660 -0.205543 v -0.448220 0.442721 -0.205543 v -0.205543 0.157340 -0.448220 v -0.205543 0.321400 -0.448220 v -0.069408 0.012594 -0.978798 v 0.978798 0.012594 0.069409 v 0.893945 0.055014 0.154261 v -0.154261 0.055014 -0.893945 v -0.069408 0.062594 -0.978798 v 0.978798 0.062594 0.069409 v 0.893945 0.105014 0.154261 v -0.154261 0.105014 -0.893945 v 0.069408 0.467220 0.978798 v -0.978798 0.467220 -0.069409 v -0.893945 0.424800 -0.154261 v 0.154261 0.424800 0.893945 v 0.069408 0.517220 0.978797 v -0.978798 0.517220 -0.069409 v -0.893945 0.474800 -0.154261 v 0.154261 0.474800 0.893945 v -0.029561 -0.000000 -1.029558 v 1.029558 0.000000 0.029561 v -1.029558 -0.000000 -0.029561 v -1.029558 0.500000 -0.029561 v 0.029561 0.000000 1.029558 v 0.029561 0.500000 1.029558 v -0.500000 0.500000 1.559119 v -1.559119 0.500000 0.500000 v -0.499999 0.500000 0.499999 v -1.559120 -0.000000 0.500000 v -0.500000 0.000000 1.559119 v -0.500003 0.000000 0.500000 v 1.029558 -0.500000 0.029561 v -0.029561 -0.500000 -1.029558 v 0.029561 -0.500000 1.029558 v -1.029558 -0.500000 -0.029561 v -0.500003 -0.500000 0.500000 v -0.500000 -0.500000 1.559119 v -1.559120 -0.500000 0.500000 vt 0.7427 0.1169 vt 0.7427 0.3317 vt 0.6400 0.3317 vt 0.6400 0.1169 vt 0.8260 0.3317 vt 0.8260 0.4343 vt 0.7427 0.4343 vt 0.8260 0.1169 vt 0.7427 0.0142 vt 0.8260 0.0142 vt 0.5691 0.2971 vt 0.5691 0.9229 vt 0.5378 0.9229 vt 0.5378 0.2971 vt 0.3413 0.2971 vt 0.3819 0.2971 vt 0.3819 0.9229 vt 0.3413 0.9229 vt 0.4291 0.9855 vt 0.4678 0.9730 vt 0.4833 0.9730 vt 0.5219 0.9855 vt 0.6097 0.9229 vt 0.6097 0.2971 vt 0.4678 0.2470 vt 0.4291 0.2345 vt 0.5219 0.2345 vt 0.4833 0.2470 vt 0.4833 0.2783 vt 0.4678 0.2783 vt 0.4132 0.2971 vt 0.4132 0.9229 vt 0.4678 0.9417 vt 0.4833 0.9417 vt 0.5182 0.9229 vt 0.5182 0.2971 vt 0.4328 0.2971 vt 0.4328 0.9229 vt 0.5026 0.9229 vt 0.5026 0.2971 vt 0.4485 0.2971 vt 0.4485 0.9229 vt 0.5026 0.2814 vt 0.4485 0.2814 vt 0.4485 0.9386 vt 0.5026 0.9386 vt 0.9588 0.9625 vt 0.9588 0.9938 vt 0.8837 0.9938 vt 0.8837 0.9625 vt 0.8524 0.0348 vt 0.8837 0.0348 vt 0.8524 0.9625 vt 0.9588 0.0035 vt 0.9588 0.0348 vt 0.8837 0.0035 vt 0.9901 0.9625 vt 0.9901 0.0348 vt 0.6554 0.3627 vt 0.6690 0.3627 vt 0.6690 0.9885 vt 0.6554 0.9885 vt 0.6972 0.9885 vt 0.6837 0.9885 vt 0.6837 0.3627 vt 0.6972 0.3627 vt 0.7119 0.3627 vt 0.7119 0.9885 vt 0.5691 0.2971 vt 0.5691 0.9229 vt 0.5378 0.9229 vt 0.5378 0.2971 vt 0.3413 0.2971 vt 0.3819 0.2971 vt 0.3819 0.9229 vt 0.3413 0.9229 vt 0.4291 0.9855 vt 0.4678 0.9730 vt 0.4833 0.9730 vt 0.5219 0.9855 vt 0.6097 0.9229 vt 0.6097 0.2971 vt 0.4678 0.2470 vt 0.4291 0.2345 vt 0.5219 0.2345 vt 0.4833 0.2470 vt 0.4833 0.2783 vt 0.4678 0.2783 vt 0.4132 0.2971 vt 0.4132 0.9229 vt 0.4678 0.9417 vt 0.4833 0.9417 vt 0.5182 0.9229 vt 0.5182 0.2971 vt 0.4328 0.2971 vt 0.4328 0.9229 vt 0.5026 0.9229 vt 0.5026 0.2971 vt 0.4485 0.2971 vt 0.4485 0.9229 vt 0.5026 0.2814 vt 0.4485 0.2814 vt 0.4485 0.9386 vt 0.5026 0.9386 vt 0.9588 0.9625 vt 0.8837 0.9625 vt 0.8837 0.0348 vt 0.9588 0.0348 vt 0.9901 0.9625 vt 0.9901 0.0348 vt 0.9588 0.0035 vt 0.8837 0.0035 vt 0.8524 0.0348 vt 0.8524 0.9625 vt 0.9588 0.9938 vt 0.8837 0.9938 vt 0.9588 0.9625 vt 0.9588 0.9938 vt 0.8837 0.9938 vt 0.8837 0.9625 vt 0.8524 0.0348 vt 0.8837 0.0348 vt 0.8524 0.9625 vt 0.9588 0.0035 vt 0.9588 0.0348 vt 0.8837 0.0035 vt 0.9901 0.9625 vt 0.9901 0.0348 vt 0.9588 0.9625 vt 0.8837 0.9625 vt 0.8837 0.0348 vt 0.9588 0.0348 vt 0.9901 0.9625 vt 0.9901 0.0348 vt 0.9588 0.0035 vt 0.8837 0.0035 vt 0.8524 0.0348 vt 0.8524 0.9625 vt 0.9588 0.9938 vt 0.8837 0.9938 vt 0.7427 0.1169 vt 0.6400 0.1169 vt 0.6400 0.3317 vt 0.7427 0.3317 vt 0.7427 0.4343 vt 0.8260 0.4343 vt 0.8260 0.3317 vt 0.8260 0.1169 vt 0.8260 0.0142 vt 0.7427 0.0142 vt 0.9588 0.9625 vt 0.8837 0.9625 vt 0.8837 0.0348 vt 0.9588 0.0348 vt 0.9901 0.9625 vt 0.9901 0.0348 vt 0.9588 0.0035 vt 0.8837 0.0035 vt 0.8524 0.0348 vt 0.8524 0.9625 vt 0.9588 0.9938 vt 0.8837 0.9938 vt 0.9588 0.9625 vt 0.8837 0.9625 vt 0.8837 0.0348 vt 0.9588 0.0348 vt 0.9901 0.9625 vt 0.9901 0.0348 vt 0.9588 0.0035 vt 0.8837 0.0035 vt 0.8524 0.0348 vt 0.8524 0.9625 vt 0.9588 0.9938 vt 0.8837 0.9938 vt -0.2938 0.5095 vt 0.6540 0.0358 vt 0.6540 0.5096 vt 0.6549 0.9852 vt -0.2928 0.5114 vt 0.6549 0.5114 vt 0.1047 0.9953 vt 0.1047 0.4934 vt 0.1047 -0.0085 vt 1.1643 -0.0085 vt 1.1643 0.9953 vt 1.1568 0.5114 vt 0.6549 0.0377 vt 1.1568 0.0377 vt -0.3972 0.9953 vt -0.3972 -0.0085 vt 1.1431 0.5009 vt 0.4334 0.5009 vt 0.4334 0.0272 vt 1.1431 0.0272 vt 1.1431 0.9747 vt 0.4334 0.9747 vt 0.7633 0.9654 vt 0.0536 0.9654 vt 0.0536 0.4916 vt 0.7633 0.4916 vt 1.1559 0.5096 vt 1.1559 0.9833 vt 0.6540 0.9833 vt 0.1053 -0.0176 vt 0.1052 0.4843 vt -0.3966 -0.0176 vt 1.0530 -0.0176 vt 1.0530 0.9861 vt 0.1053 0.9861 vt -0.3966 0.9861 vt 0.0536 0.0179 vt 0.7633 0.0179 vt -0.2928 0.0377 vt -0.2938 0.9833 vt 0.0455 0.1273 vt 1.0492 0.1273 vt 1.0492 0.6011 vt 0.0455 0.6011 vt 1.1568 0.9852 vt 1.1559 0.0358 vn -0.7071 0.0000 -0.7071 vn 0.7071 0.0000 -0.7071 vn -0.7071 0.0000 0.7071 vn 0.2357 0.9428 -0.2357 vn 0.7071 0.0000 0.7071 vn 0.0189 0.9017 -0.4319 vn 0.4319 0.9017 -0.0189 vn -0.1263 -0.9320 0.3397 vn -0.3397 -0.9320 0.1263 vn -0.2357 -0.9428 0.2357 vn 0.0000 1.0000 0.0000 vn -0.0000 0.0000 1.0000 vn -1.0000 0.0000 0.0000 vn 0.0000 -1.0000 0.0000 g dtrack_vst2_45_Cube.035_SlopeRailMaterial s off f 2/1/1 4/2/1 3/3/1 1/4/1 f 4/2/2 8/5/2 7/6/2 3/7/2 f 6/8/3 2/1/3 1/9/3 5/10/3 f 6/8/4 8/5/4 4/2/4 2/1/4 f 16/11/5 15/12/5 19/13/5 20/14/5 f 9/15/6 13/16/6 14/17/6 10/18/6 f 10/19/2 14/20/2 15/21/2 11/22/2 f 11/23/7 15/12/7 16/11/7 12/24/7 f 13/25/3 9/26/3 12/27/3 16/28/3 f 20/29/3 17/30/3 13/25/3 16/28/3 f 13/16/1 17/31/1 18/32/1 14/17/1 f 15/21/2 14/20/2 18/33/2 19/34/2 f 20/14/8 19/13/8 21/35/8 22/36/8 f 18/32/9 17/31/9 23/37/9 24/38/9 f 22/36/5 21/35/5 25/39/5 26/40/5 f 24/38/1 23/37/1 27/41/1 28/42/1 f 25/39/4 28/42/4 27/41/4 26/40/4 f 17/30/3 20/29/3 22/43/3 26/40/3 27/41/3 23/44/3 f 18/33/2 24/45/2 28/42/2 25/39/2 21/46/2 19/34/2 f 32/47/5 36/48/5 33/49/5 29/50/5 f 34/51/2 30/52/2 29/50/2 33/53/2 f 35/54/1 31/55/1 30/52/1 34/56/1 f 36/57/3 32/47/3 31/55/3 35/58/3 f 32/47/4 29/50/4 30/52/4 31/55/4 f 37/59/1 39/60/1 40/61/1 38/62/1 f 41/63/5 43/64/5 44/65/5 42/66/5 f 37/67/10 38/68/10 41/63/10 42/66/10 f 39/60/4 44/65/4 43/64/4 40/61/4 f 52/69/1 51/70/1 55/71/1 56/72/1 f 45/73/7 49/74/7 50/75/7 46/76/7 f 46/77/3 50/78/3 51/79/3 47/80/3 f 47/81/6 51/70/6 52/69/6 48/82/6 f 49/83/2 45/84/2 48/85/2 52/86/2 f 56/87/2 53/88/2 49/83/2 52/86/2 f 49/74/5 53/89/5 54/90/5 50/75/5 f 51/79/3 50/78/3 54/91/3 55/92/3 f 56/72/9 55/71/9 57/93/9 58/94/9 f 54/90/8 53/89/8 59/95/8 60/96/8 f 58/94/1 57/93/1 61/97/1 62/98/1 f 60/96/5 59/95/5 63/99/5 64/100/5 f 61/97/4 64/100/4 63/99/4 62/98/4 f 53/88/2 56/87/2 58/101/2 62/98/2 63/99/2 59/102/2 f 54/91/3 60/103/3 64/100/3 61/97/3 57/104/3 55/92/3 f 69/105/4 72/106/4 71/107/4 70/108/4 f 65/109/2 69/105/2 70/108/2 66/110/2 f 66/111/5 70/108/5 71/107/5 67/112/5 f 67/113/3 71/107/3 72/106/3 68/114/3 f 69/105/1 65/115/1 68/116/1 72/106/1 f 76/117/5 80/118/5 77/119/5 73/120/5 f 78/121/2 74/122/2 73/120/2 77/123/2 f 79/124/1 75/125/1 74/122/1 78/126/1 f 80/127/3 76/117/3 75/125/3 79/128/3 f 76/117/4 73/120/4 74/122/4 75/125/4 f 85/129/4 88/130/4 87/131/4 86/132/4 f 81/133/2 85/129/2 86/132/2 82/134/2 f 82/135/5 86/132/5 87/131/5 83/136/5 f 83/137/3 87/131/3 88/130/3 84/138/3 f 85/129/1 81/139/1 84/140/1 88/130/1 f 90/141/5 89/142/5 91/143/5 92/144/5 f 92/144/2 91/145/2 95/146/2 96/147/2 f 94/148/3 93/149/3 89/150/3 90/141/3 f 94/148/4 90/141/4 92/144/4 96/147/4 f 101/151/4 104/152/4 103/153/4 102/154/4 f 97/155/2 101/151/2 102/154/2 98/156/2 f 98/157/5 102/154/5 103/153/5 99/158/5 f 99/159/3 103/153/3 104/152/3 100/160/3 f 101/151/1 97/161/1 100/162/1 104/152/1 f 109/163/4 112/164/4 111/165/4 110/166/4 f 105/167/3 109/163/3 110/166/3 106/168/3 f 106/169/1 110/166/1 111/165/1 107/170/1 f 107/171/2 111/165/2 112/164/2 108/172/2 f 109/163/5 105/173/5 108/174/5 112/164/5 g dtrack_vst2_45_Cube.035_SlopeGravelMaterial f 114/175/5 118/176/5 117/177/5 f 116/178/1 113/179/1 115/180/1 f 116/181/4 121/182/4 118/183/4 114/184/4 113/185/4 f 122/186/1 115/180/1 128/187/1 131/188/1 f 116/181/11 120/189/11 121/182/11 f 118/183/11 121/182/11 119/190/11 f 124/191/12 122/192/12 131/193/12 129/194/12 f 121/195/12 120/196/12 122/192/12 124/191/12 f 119/197/13 121/198/13 124/199/13 123/200/13 f 117/177/5 123/201/5 130/202/5 127/203/5 f 128/204/14 129/205/14 131/206/14 f 126/207/14 125/208/14 127/209/14 129/205/14 128/204/14 f 130/210/14 129/205/14 127/209/14 f 123/200/13 124/199/13 129/211/13 130/212/13 f 115/180/1 113/179/1 126/213/1 128/187/1 f 114/175/5 117/177/5 127/203/5 125/214/5 f 113/215/2 114/216/2 125/217/2 126/218/2 f 116/178/1 115/180/1 122/186/1 120/219/1 f 117/177/5 118/176/5 119/220/5 123/201/5