1 |
/* |
/* |
2 |
** Lua binding: enigma |
** Lua binding: enigma |
3 |
** Generated automatically by tolua 4.0a on Tue Jun 10 14:01:16 2003. |
** Generated automatically by tolua 4.0a on Sun Jun 15 10:17:42 2003. |
4 |
*/ |
*/ |
5 |
|
|
6 |
#include "tolua.h" |
#include "tolua.h" |
10 |
void tolua_enigma_close (lua_State* tolua_S); |
void tolua_enigma_close (lua_State* tolua_S); |
11 |
|
|
12 |
#include "enigma.hh" |
#include "enigma.hh" |
|
#include "game.hh" |
|
13 |
using namespace enigma; |
using namespace enigma; |
14 |
using px::Surface; |
using px::Surface; |
15 |
using px::Font; |
using px::Font; |
16 |
|
#include "game.hh" |
17 |
#include "world.hh" |
#include "world.hh" |
18 |
#include "objects.hh" |
#include "objects.hh" |
19 |
using namespace world; |
using namespace world; |
20 |
#include "video.hh" |
#include "video.hh" |
21 |
using namespace video; |
using namespace video; |
22 |
using px::Screen; |
using px::Screen; |
|
#include "display.hh" |
|
|
using namespace display; |
|
|
using px::Rect; |
|
23 |
#include "options.hh" |
#include "options.hh" |
24 |
using namespace options; |
using namespace options; |
25 |
|
|
26 |
/* function to register type */ |
/* function to register type */ |
27 |
static void toluaI_reg_types (lua_State* tolua_S) |
static void toluaI_reg_types (lua_State* tolua_S) |
28 |
{ |
{ |
29 |
tolua_usertype(tolua_S,"Stone"); |
tolua_usertype(tolua_S,"Font"); |
|
tolua_usertype(tolua_S,"Rect"); |
|
30 |
tolua_usertype(tolua_S,"Item"); |
tolua_usertype(tolua_S,"Item"); |
31 |
tolua_usertype(tolua_S,"Object"); |
tolua_usertype(tolua_S,"Object"); |
32 |
tolua_usertype(tolua_S,"LevelStatus"); |
tolua_usertype(tolua_S,"LevelStatus"); |
33 |
tolua_usertype(tolua_S,"Screen"); |
tolua_usertype(tolua_S,"Screen"); |
34 |
tolua_usertype(tolua_S,"Font"); |
tolua_usertype(tolua_S,"Stone"); |
35 |
tolua_usertype(tolua_S,"Floor"); |
tolua_usertype(tolua_S,"Floor"); |
36 |
tolua_usertype(tolua_S,"Surface"); |
tolua_usertype(tolua_S,"Surface"); |
37 |
} |
} |
38 |
|
|
39 |
/* function: AddLevelPack */ |
/* function: GetImage */ |
40 |
static int toluaI_enigma_enigma_AddLevelPack00(lua_State* tolua_S) |
static int toluaI_enigma_enigma_GetImage00(lua_State* tolua_S) |
41 |
{ |
{ |
42 |
if ( |
if ( |
43 |
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
44 |
!tolua_istype(tolua_S,2,LUA_TSTRING,0) || |
!tolua_isnoobj(tolua_S,2) |
|
!tolua_isnoobj(tolua_S,3) |
|
45 |
) |
) |
46 |
goto tolua_lerror; |
goto tolua_lerror; |
47 |
else |
else |
48 |
{ |
{ |
49 |
const char* init_file = ((const char*) tolua_getstring(tolua_S,1,0)); |
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
const char* name = ((const char*) tolua_getstring(tolua_S,2,0)); |
|
50 |
{ |
{ |
51 |
AddLevelPack(init_file,name); |
Surface* toluaI_ret = (Surface*) GetImage(name); |
52 |
|
tolua_pushusertype(tolua_S,(void*)toluaI_ret,tolua_tag(tolua_S,"Surface")); |
53 |
} |
} |
54 |
} |
} |
55 |
return 0; |
return 1; |
56 |
tolua_lerror: |
tolua_lerror: |
57 |
tolua_error(tolua_S,"#ferror in function 'AddLevelPack'."); |
tolua_error(tolua_S,"#ferror in function 'GetImage'."); |
58 |
return 0; |
return 0; |
59 |
} |
} |
60 |
|
|
61 |
/* function: AddZippedLevelPack */ |
/* function: LoadImage */ |
62 |
static int toluaI_enigma_enigma_AddZippedLevelPack00(lua_State* tolua_S) |
static int toluaI_enigma_enigma_LoadImage00(lua_State* tolua_S) |
63 |
{ |
{ |
64 |
if ( |
if ( |
65 |
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
68 |
goto tolua_lerror; |
goto tolua_lerror; |
69 |
else |
else |
70 |
{ |
{ |
71 |
const char* zipfile = ((const char*) tolua_getstring(tolua_S,1,0)); |
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
72 |
{ |
{ |
73 |
AddZippedLevelPack(zipfile); |
Surface* toluaI_ret = (Surface*) LoadImage(name); |
74 |
|
tolua_pushusertype(tolua_S,(void*)toluaI_ret,tolua_tag(tolua_S,"Surface")); |
75 |
} |
} |
76 |
} |
} |
77 |
|
return 1; |
78 |
|
tolua_lerror: |
79 |
|
tolua_error(tolua_S,"#ferror in function 'LoadImage'."); |
80 |
return 0; |
return 0; |
81 |
|
} |
82 |
|
|
83 |
|
/* function: GetFont */ |
84 |
|
static int toluaI_enigma_enigma_GetFont00(lua_State* tolua_S) |
85 |
|
{ |
86 |
|
if ( |
87 |
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
88 |
|
!tolua_isnoobj(tolua_S,2) |
89 |
|
) |
90 |
|
goto tolua_lerror; |
91 |
|
else |
92 |
|
{ |
93 |
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
94 |
|
{ |
95 |
|
Font* toluaI_ret = (Font*) GetFont(name); |
96 |
|
tolua_pushusertype(tolua_S,(void*)toluaI_ret,tolua_tag(tolua_S,"Font")); |
97 |
|
} |
98 |
|
} |
99 |
|
return 1; |
100 |
tolua_lerror: |
tolua_lerror: |
101 |
tolua_error(tolua_S,"#ferror in function 'AddZippedLevelPack'."); |
tolua_error(tolua_S,"#ferror in function 'GetFont'."); |
102 |
return 0; |
return 0; |
103 |
} |
} |
104 |
|
|
134 |
return 0; |
return 0; |
135 |
} |
} |
136 |
|
|
137 |
/* get function: Difficulty */ |
/* get function: ShowMoves */ |
138 |
static int toluaI_get_enigma_enigma_Difficulty(lua_State* tolua_S) |
static int toluaI_get_enigma_enigma_ShowMoves(lua_State* tolua_S) |
139 |
{ |
{ |
140 |
tolua_pushnumber(tolua_S,(double)Difficulty); |
tolua_pushnumber(tolua_S,(double)ShowMoves); |
141 |
return 1; |
return 1; |
142 |
} |
} |
143 |
|
|
144 |
/* set function: Difficulty */ |
/* set function: ShowMoves */ |
145 |
static int toluaI_set_enigma_enigma_Difficulty(lua_State* tolua_S) |
static int toluaI_set_enigma_enigma_ShowMoves(lua_State* tolua_S) |
146 |
{ |
{ |
147 |
if (!tolua_istype(tolua_S,1,LUA_TNUMBER,0)) |
if (!tolua_istype(tolua_S,1,LUA_TNUMBER,0)) |
148 |
tolua_error(tolua_S,"#vinvalid type in variable assignment."); |
tolua_error(tolua_S,"#vinvalid type in variable assignment."); |
149 |
Difficulty = ((int) tolua_getnumber(tolua_S,1,0)); |
ShowMoves = ((int) tolua_getnumber(tolua_S,1,0)); |
150 |
return 0; |
return 0; |
151 |
} |
} |
152 |
|
|
153 |
/* get function: ShowMoves */ |
/* get function: Brittleness */ |
154 |
static int toluaI_get_enigma_enigma_ShowMoves(lua_State* tolua_S) |
static int toluaI_get_enigma_enigma_Brittleness(lua_State* tolua_S) |
155 |
{ |
{ |
156 |
tolua_pushnumber(tolua_S,(double)ShowMoves); |
tolua_pushnumber(tolua_S,(double)Brittleness); |
157 |
return 1; |
return 1; |
158 |
} |
} |
159 |
|
|
160 |
/* set function: ShowMoves */ |
/* set function: Brittleness */ |
161 |
static int toluaI_set_enigma_enigma_ShowMoves(lua_State* tolua_S) |
static int toluaI_set_enigma_enigma_Brittleness(lua_State* tolua_S) |
162 |
{ |
{ |
163 |
if (!tolua_istype(tolua_S,1,LUA_TNUMBER,0)) |
if (!tolua_istype(tolua_S,1,LUA_TNUMBER,0)) |
164 |
tolua_error(tolua_S,"#vinvalid type in variable assignment."); |
tolua_error(tolua_S,"#vinvalid type in variable assignment."); |
165 |
ShowMoves = ((int) tolua_getnumber(tolua_S,1,0)); |
Brittleness = ((double) tolua_getnumber(tolua_S,1,0)); |
166 |
return 0; |
return 0; |
167 |
} |
} |
168 |
|
|
169 |
/* function: GetImage */ |
/* get function: SlopeForce */ |
170 |
static int toluaI_enigma_enigma_GetImage00(lua_State* tolua_S) |
static int toluaI_get_enigma_enigma_SlopeForce(lua_State* tolua_S) |
171 |
{ |
{ |
172 |
if ( |
tolua_pushnumber(tolua_S,(double)SlopeForce); |
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_isnoobj(tolua_S,2) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
{ |
|
|
Surface* toluaI_ret = (Surface*) GetImage(name); |
|
|
tolua_pushusertype(tolua_S,(void*)toluaI_ret,tolua_tag(tolua_S,"Surface")); |
|
|
} |
|
|
} |
|
173 |
return 1; |
return 1; |
174 |
tolua_lerror: |
} |
175 |
tolua_error(tolua_S,"#ferror in function 'GetImage'."); |
|
176 |
|
/* set function: SlopeForce */ |
177 |
|
static int toluaI_set_enigma_enigma_SlopeForce(lua_State* tolua_S) |
178 |
|
{ |
179 |
|
if (!tolua_istype(tolua_S,1,LUA_TNUMBER,0)) |
180 |
|
tolua_error(tolua_S,"#vinvalid type in variable assignment."); |
181 |
|
SlopeForce = ((double) tolua_getnumber(tolua_S,1,0)); |
182 |
return 0; |
return 0; |
183 |
} |
} |
184 |
|
|
185 |
/* function: LoadImage */ |
/* get function: SlopeForce2 */ |
186 |
static int toluaI_enigma_enigma_LoadImage00(lua_State* tolua_S) |
static int toluaI_get_enigma_enigma_SlopeForce2(lua_State* tolua_S) |
187 |
|
{ |
188 |
|
tolua_pushnumber(tolua_S,(double)SlopeForce2); |
189 |
|
return 1; |
190 |
|
} |
191 |
|
|
192 |
|
/* set function: SlopeForce2 */ |
193 |
|
static int toluaI_set_enigma_enigma_SlopeForce2(lua_State* tolua_S) |
194 |
|
{ |
195 |
|
if (!tolua_istype(tolua_S,1,LUA_TNUMBER,0)) |
196 |
|
tolua_error(tolua_S,"#vinvalid type in variable assignment."); |
197 |
|
SlopeForce2 = ((double) tolua_getnumber(tolua_S,1,0)); |
198 |
|
return 0; |
199 |
|
} |
200 |
|
|
201 |
|
/* get function: FrictionFactor */ |
202 |
|
static int toluaI_get_enigma_enigma_FrictionFactor(lua_State* tolua_S) |
203 |
|
{ |
204 |
|
tolua_pushnumber(tolua_S,(double)FrictionFactor); |
205 |
|
return 1; |
206 |
|
} |
207 |
|
|
208 |
|
/* set function: FrictionFactor */ |
209 |
|
static int toluaI_set_enigma_enigma_FrictionFactor(lua_State* tolua_S) |
210 |
|
{ |
211 |
|
if (!tolua_istype(tolua_S,1,LUA_TNUMBER,0)) |
212 |
|
tolua_error(tolua_S,"#vinvalid type in variable assignment."); |
213 |
|
FrictionFactor = ((double) tolua_getnumber(tolua_S,1,0)); |
214 |
|
return 0; |
215 |
|
} |
216 |
|
|
217 |
|
/* function: AddLevelPack */ |
218 |
|
static int toluaI_enigma_enigma_AddLevelPack00(lua_State* tolua_S) |
219 |
{ |
{ |
220 |
if ( |
if ( |
221 |
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
222 |
!tolua_isnoobj(tolua_S,2) |
!tolua_istype(tolua_S,2,LUA_TSTRING,0) || |
223 |
|
!tolua_isnoobj(tolua_S,3) |
224 |
) |
) |
225 |
goto tolua_lerror; |
goto tolua_lerror; |
226 |
else |
else |
227 |
{ |
{ |
228 |
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
const char* init_file = ((const char*) tolua_getstring(tolua_S,1,0)); |
229 |
|
const char* name = ((const char*) tolua_getstring(tolua_S,2,0)); |
230 |
{ |
{ |
231 |
Surface* toluaI_ret = (Surface*) LoadImage(name); |
AddLevelPack(init_file,name); |
|
tolua_pushusertype(tolua_S,(void*)toluaI_ret,tolua_tag(tolua_S,"Surface")); |
|
232 |
} |
} |
233 |
} |
} |
234 |
return 1; |
return 0; |
235 |
tolua_lerror: |
tolua_lerror: |
236 |
tolua_error(tolua_S,"#ferror in function 'LoadImage'."); |
tolua_error(tolua_S,"#ferror in function 'AddLevelPack'."); |
237 |
return 0; |
return 0; |
238 |
} |
} |
239 |
|
|
240 |
/* function: GetFont */ |
/* function: AddZippedLevelPack */ |
241 |
static int toluaI_enigma_enigma_GetFont00(lua_State* tolua_S) |
static int toluaI_enigma_enigma_AddZippedLevelPack00(lua_State* tolua_S) |
242 |
{ |
{ |
243 |
if ( |
if ( |
244 |
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
247 |
goto tolua_lerror; |
goto tolua_lerror; |
248 |
else |
else |
249 |
{ |
{ |
250 |
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
const char* zipfile = ((const char*) tolua_getstring(tolua_S,1,0)); |
251 |
{ |
{ |
252 |
Font* toluaI_ret = (Font*) GetFont(name); |
AddZippedLevelPack(zipfile); |
|
tolua_pushusertype(tolua_S,(void*)toluaI_ret,tolua_tag(tolua_S,"Font")); |
|
253 |
} |
} |
254 |
} |
} |
255 |
return 1; |
return 0; |
256 |
tolua_lerror: |
tolua_lerror: |
257 |
tolua_error(tolua_S,"#ferror in function 'GetFont'."); |
tolua_error(tolua_S,"#ferror in function 'AddZippedLevelPack'."); |
258 |
return 0; |
return 0; |
259 |
} |
} |
260 |
|
|
563 |
return 0; |
return 0; |
564 |
} |
} |
565 |
|
|
|
/* function: GetColorDepth */ |
|
|
static int toluaI_enigma_video_GetColorDepth00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_isnoobj(tolua_S,1) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
{ |
|
|
int toluaI_ret = (int) GetColorDepth(); |
|
|
tolua_pushnumber(tolua_S,(double)toluaI_ret); |
|
|
} |
|
|
} |
|
|
return 1; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'GetColorDepth'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
566 |
/* function: GetScreen */ |
/* function: GetScreen */ |
567 |
static int toluaI_enigma_video_GetScreen00(lua_State* tolua_S) |
static int toluaI_enigma_video_GetScreen00(lua_State* tolua_S) |
568 |
{ |
{ |
621 |
return 0; |
return 0; |
622 |
} |
} |
623 |
|
|
|
/* function: SetFollowMode */ |
|
|
static int toluaI_enigma_display_SetFollowMode00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TNUMBER,0) || |
|
|
!tolua_isnoobj(tolua_S,2) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
FollowMode m = ((FollowMode) tolua_getnumber(tolua_S,1,0)); |
|
|
{ |
|
|
SetFollowMode(m); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'SetFollowMode'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: DefineImage */ |
|
|
static int toluaI_enigma_display_DefineImage00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,3,LUA_TNUMBER,0) || |
|
|
!tolua_istype(tolua_S,4,LUA_TNUMBER,0) || |
|
|
!tolua_isnoobj(tolua_S,5) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
const char* fname = ((const char*) tolua_getstring(tolua_S,2,0)); |
|
|
int xoff = ((int) tolua_getnumber(tolua_S,3,0)); |
|
|
int yoff = ((int) tolua_getnumber(tolua_S,4,0)); |
|
|
{ |
|
|
DefineImage(name,fname,xoff,yoff); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'DefineImage'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: DefineSubImage */ |
|
|
static int toluaI_enigma_display_DefineSubImage00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,3,LUA_TNUMBER,0) || |
|
|
!tolua_istype(tolua_S,4,LUA_TNUMBER,0) || |
|
|
!tolua_istype(tolua_S,5,tolua_tag(tolua_S,"Rect"),0) || |
|
|
!tolua_isnoobj(tolua_S,6) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
const char* fname = ((const char*) tolua_getstring(tolua_S,2,0)); |
|
|
int xoff = ((int) tolua_getnumber(tolua_S,3,0)); |
|
|
int yoff = ((int) tolua_getnumber(tolua_S,4,0)); |
|
|
Rect r = *((Rect*) tolua_getusertype(tolua_S,5,0)); |
|
|
{ |
|
|
DefineSubImage(name,fname,xoff,yoff,r); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'DefineSubImage'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: DefineRandModel */ |
|
|
static int toluaI_enigma_display_DefineRandModel00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,LUA_TNUMBER,0) || |
|
|
!tolua_istype(tolua_S,3,LUA_TTABLE,0) || |
|
|
!tolua_isnoobj(tolua_S,4) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
int n = ((int) tolua_getnumber(tolua_S,2,0)); |
|
|
const char** names = (const char**) malloc(n*sizeof(char*)); |
|
|
{ |
|
|
if (!tolua_arrayistype(tolua_S,3,LUA_TSTRING,n,0)) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
int i; |
|
|
for(i=0; i<n;i++) |
|
|
names[i] = ((const char*) tolua_getfieldstring(tolua_S,3,i+1,0)); |
|
|
} |
|
|
} |
|
|
{ |
|
|
DefineRandModel(name,n,names); |
|
|
} |
|
|
{ |
|
|
int i; |
|
|
for(i=0; i<n;i++) |
|
|
tolua_pushfieldstring(tolua_S,3,i+1,(const char*) names[i]); |
|
|
} |
|
|
free(names); |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'DefineRandModel'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: DefineShadedModel */ |
|
|
static int toluaI_enigma_display_DefineShadedModel00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,3,LUA_TSTRING,0) || |
|
|
!tolua_isnoobj(tolua_S,4) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
const char* model = ((const char*) tolua_getstring(tolua_S,2,0)); |
|
|
const char* shade = ((const char*) tolua_getstring(tolua_S,3,0)); |
|
|
{ |
|
|
DefineShadedModel(name,model,shade); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'DefineShadedModel'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: DefineOverlayImage */ |
|
|
static int toluaI_enigma_display_DefineOverlayImage00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,LUA_TNUMBER,0) || |
|
|
!tolua_istype(tolua_S,3,LUA_TTABLE,0) || |
|
|
!tolua_isnoobj(tolua_S,4) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
int n = ((int) tolua_getnumber(tolua_S,2,0)); |
|
|
const char** images = (const char**) malloc(n*sizeof(char*)); |
|
|
{ |
|
|
if (!tolua_arrayistype(tolua_S,3,LUA_TSTRING,n,0)) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
int i; |
|
|
for(i=0; i<n;i++) |
|
|
images[i] = ((const char*) tolua_getfieldstring(tolua_S,3,i+1,0)); |
|
|
} |
|
|
} |
|
|
{ |
|
|
DefineOverlayImage(name,n,images); |
|
|
} |
|
|
{ |
|
|
int i; |
|
|
for(i=0; i<n;i++) |
|
|
tolua_pushfieldstring(tolua_S,3,i+1,(const char*) images[i]); |
|
|
} |
|
|
free(images); |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'DefineOverlayImage'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: DefineComposite */ |
|
|
static int toluaI_enigma_display_DefineComposite00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,3,LUA_TSTRING,0) || |
|
|
!tolua_isnoobj(tolua_S,4) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
const char* bgname = ((const char*) tolua_getstring(tolua_S,2,0)); |
|
|
const char* fgname = ((const char*) tolua_getstring(tolua_S,3,0)); |
|
|
{ |
|
|
DefineComposite(name,bgname,fgname); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'DefineComposite'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: DefineAnim */ |
|
|
static int toluaI_enigma_display_DefineAnim00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,tolua_tag(tolua_S,"bool"),0) || |
|
|
!tolua_isnoobj(tolua_S,3) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
bool loop_p = ((bool) tolua_getbool(tolua_S,2,0)); |
|
|
{ |
|
|
DefineAnim(name,loop_p); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'DefineAnim'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: AddFrame */ |
|
|
static int toluaI_enigma_display_AddFrame00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,3,LUA_TNUMBER,0) || |
|
|
!tolua_isnoobj(tolua_S,4) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
const char* model = ((const char*) tolua_getstring(tolua_S,2,0)); |
|
|
double time = ((double) tolua_getnumber(tolua_S,3,0)); |
|
|
{ |
|
|
AddFrame(name,model,time); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'AddFrame'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
|
/* function: DefineAlias */ |
|
|
static int toluaI_enigma_display_DefineAlias00(lua_State* tolua_S) |
|
|
{ |
|
|
if ( |
|
|
!tolua_istype(tolua_S,1,LUA_TSTRING,0) || |
|
|
!tolua_istype(tolua_S,2,LUA_TSTRING,0) || |
|
|
!tolua_isnoobj(tolua_S,3) |
|
|
) |
|
|
goto tolua_lerror; |
|
|
else |
|
|
{ |
|
|
const char* name = ((const char*) tolua_getstring(tolua_S,1,0)); |
|
|
const char* othername = ((const char*) tolua_getstring(tolua_S,2,0)); |
|
|
{ |
|
|
DefineAlias(name,othername); |
|
|
} |
|
|
} |
|
|
return 0; |
|
|
tolua_lerror: |
|
|
tolua_error(tolua_S,"#ferror in function 'DefineAlias'."); |
|
|
return 0; |
|
|
} |
|
|
|
|
624 |
/* get function: MouseSpeed */ |
/* get function: MouseSpeed */ |
625 |
static int toluaI_get_enigma_options_MouseSpeed(lua_State* tolua_S) |
static int toluaI_get_enigma_options_MouseSpeed(lua_State* tolua_S) |
626 |
{ |
{ |
765 |
return 0; |
return 0; |
766 |
} |
} |
767 |
|
|
768 |
|
/* get function: Difficulty */ |
769 |
|
static int toluaI_get_enigma_options_Difficulty(lua_State* tolua_S) |
770 |
|
{ |
771 |
|
tolua_pushnumber(tolua_S,(double)Difficulty); |
772 |
|
return 1; |
773 |
|
} |
774 |
|
|
775 |
|
/* set function: Difficulty */ |
776 |
|
static int toluaI_set_enigma_options_Difficulty(lua_State* tolua_S) |
777 |
|
{ |
778 |
|
if (!tolua_istype(tolua_S,1,LUA_TNUMBER,0)) |
779 |
|
tolua_error(tolua_S,"#vinvalid type in variable assignment."); |
780 |
|
Difficulty = ((int) tolua_getnumber(tolua_S,1,0)); |
781 |
|
return 0; |
782 |
|
} |
783 |
|
|
784 |
/* method: new of class LevelStatus */ |
/* method: new of class LevelStatus */ |
785 |
static int toluaI_enigma_options_LevelStatus_new00(lua_State* tolua_S) |
static int toluaI_enigma_options_LevelStatus_new00(lua_State* tolua_S) |
786 |
{ |
{ |
865 |
tolua_constant(tolua_S,"enigma","EAST",EAST); |
tolua_constant(tolua_S,"enigma","EAST",EAST); |
866 |
tolua_constant(tolua_S,"enigma","SOUTH",SOUTH); |
tolua_constant(tolua_S,"enigma","SOUTH",SOUTH); |
867 |
tolua_constant(tolua_S,"enigma","WEST",WEST); |
tolua_constant(tolua_S,"enigma","WEST",WEST); |
|
tolua_function(tolua_S,"enigma","AddLevelPack",toluaI_enigma_enigma_AddLevelPack00); |
|
|
tolua_function(tolua_S,"enigma","AddZippedLevelPack",toluaI_enigma_enigma_AddZippedLevelPack00); |
|
|
tolua_tablevar(tolua_S,"enigma","ConserveLevel",toluaI_get_enigma_enigma_ConserveLevel,toluaI_set_enigma_enigma_ConserveLevel); |
|
|
tolua_tablevar(tolua_S,"enigma","AllowTogglePlayer",toluaI_get_enigma_enigma_AllowTogglePlayer,toluaI_set_enigma_enigma_AllowTogglePlayer); |
|
|
tolua_tablevar(tolua_S,"enigma","Difficulty",toluaI_get_enigma_enigma_Difficulty,toluaI_set_enigma_enigma_Difficulty); |
|
|
tolua_tablevar(tolua_S,"enigma","ShowMoves",toluaI_get_enigma_enigma_ShowMoves,toluaI_set_enigma_enigma_ShowMoves); |
|
868 |
tolua_function(tolua_S,"enigma","GetImage",toluaI_enigma_enigma_GetImage00); |
tolua_function(tolua_S,"enigma","GetImage",toluaI_enigma_enigma_GetImage00); |
869 |
tolua_function(tolua_S,"enigma","LoadImage",toluaI_enigma_enigma_LoadImage00); |
tolua_function(tolua_S,"enigma","LoadImage",toluaI_enigma_enigma_LoadImage00); |
870 |
tolua_function(tolua_S,"enigma","GetFont",toluaI_enigma_enigma_GetFont00); |
tolua_function(tolua_S,"enigma","GetFont",toluaI_enigma_enigma_GetFont00); |
871 |
|
tolua_module(tolua_S,"enigma"); |
872 |
|
tolua_tablevar(tolua_S,"enigma","ConserveLevel",toluaI_get_enigma_enigma_ConserveLevel,toluaI_set_enigma_enigma_ConserveLevel); |
873 |
|
tolua_tablevar(tolua_S,"enigma","AllowTogglePlayer",toluaI_get_enigma_enigma_AllowTogglePlayer,toluaI_set_enigma_enigma_AllowTogglePlayer); |
874 |
|
tolua_tablevar(tolua_S,"enigma","ShowMoves",toluaI_get_enigma_enigma_ShowMoves,toluaI_set_enigma_enigma_ShowMoves); |
875 |
|
tolua_tablevar(tolua_S,"enigma","Brittleness",toluaI_get_enigma_enigma_Brittleness,toluaI_set_enigma_enigma_Brittleness); |
876 |
|
tolua_tablevar(tolua_S,"enigma","SlopeForce",toluaI_get_enigma_enigma_SlopeForce,toluaI_set_enigma_enigma_SlopeForce); |
877 |
|
tolua_tablevar(tolua_S,"enigma","SlopeForce2",toluaI_get_enigma_enigma_SlopeForce2,toluaI_set_enigma_enigma_SlopeForce2); |
878 |
|
tolua_tablevar(tolua_S,"enigma","FrictionFactor",toluaI_get_enigma_enigma_FrictionFactor,toluaI_set_enigma_enigma_FrictionFactor); |
879 |
|
tolua_function(tolua_S,"enigma","AddLevelPack",toluaI_enigma_enigma_AddLevelPack00); |
880 |
|
tolua_function(tolua_S,"enigma","AddZippedLevelPack",toluaI_enigma_enigma_AddZippedLevelPack00); |
881 |
tolua_function(tolua_S,"enigma","FinishLevel",toluaI_enigma_enigma_FinishLevel00); |
tolua_function(tolua_S,"enigma","FinishLevel",toluaI_enigma_enigma_FinishLevel00); |
882 |
tolua_function(tolua_S,"enigma","RestartLevel",toluaI_enigma_enigma_RestartLevel00); |
tolua_function(tolua_S,"enigma","RestartLevel",toluaI_enigma_enigma_RestartLevel00); |
883 |
tolua_function(tolua_S,"enigma","QuitGame",toluaI_enigma_enigma_QuitGame00); |
tolua_function(tolua_S,"enigma","QuitGame",toluaI_enigma_enigma_QuitGame00); |
897 |
tolua_function(tolua_S,"world","DefineSimpleStoneMovable",toluaI_enigma_world_DefineSimpleStoneMovable00); |
tolua_function(tolua_S,"world","DefineSimpleStoneMovable",toluaI_enigma_world_DefineSimpleStoneMovable00); |
898 |
tolua_function(tolua_S,"world","DefineSimpleFloor",toluaI_enigma_world_DefineSimpleFloor00); |
tolua_function(tolua_S,"world","DefineSimpleFloor",toluaI_enigma_world_DefineSimpleFloor00); |
899 |
tolua_module(tolua_S,"video"); |
tolua_module(tolua_S,"video"); |
|
tolua_function(tolua_S,"video","GetColorDepth",toluaI_enigma_video_GetColorDepth00); |
|
900 |
tolua_function(tolua_S,"video","GetScreen",toluaI_enigma_video_GetScreen00); |
tolua_function(tolua_S,"video","GetScreen",toluaI_enigma_video_GetScreen00); |
901 |
tolua_function(tolua_S,"video","HideMouse",toluaI_enigma_video_HideMouse00); |
tolua_function(tolua_S,"video","HideMouse",toluaI_enigma_video_HideMouse00); |
902 |
tolua_function(tolua_S,"video","ShowMouse",toluaI_enigma_video_ShowMouse00); |
tolua_function(tolua_S,"video","ShowMouse",toluaI_enigma_video_ShowMouse00); |
|
tolua_module(tolua_S,"display"); |
|
|
tolua_constant(tolua_S,"display","FOLLOW_SCROLLING",FOLLOW_SCROLLING); |
|
|
tolua_constant(tolua_S,"display","FOLLOW_SCREEN",FOLLOW_SCREEN); |
|
|
tolua_function(tolua_S,"display","SetFollowMode",toluaI_enigma_display_SetFollowMode00); |
|
|
tolua_function(tolua_S,"display","DefineImage",toluaI_enigma_display_DefineImage00); |
|
|
tolua_function(tolua_S,"display","DefineSubImage",toluaI_enigma_display_DefineSubImage00); |
|
|
tolua_function(tolua_S,"display","DefineRandModel",toluaI_enigma_display_DefineRandModel00); |
|
|
tolua_function(tolua_S,"display","DefineShadedModel",toluaI_enigma_display_DefineShadedModel00); |
|
|
tolua_function(tolua_S,"display","DefineOverlayImage",toluaI_enigma_display_DefineOverlayImage00); |
|
|
tolua_function(tolua_S,"display","DefineComposite",toluaI_enigma_display_DefineComposite00); |
|
|
tolua_function(tolua_S,"display","DefineAnim",toluaI_enigma_display_DefineAnim00); |
|
|
tolua_function(tolua_S,"display","AddFrame",toluaI_enigma_display_AddFrame00); |
|
|
tolua_function(tolua_S,"display","DefineAlias",toluaI_enigma_display_DefineAlias00); |
|
903 |
tolua_module(tolua_S,"options"); |
tolua_module(tolua_S,"options"); |
904 |
tolua_tablevar(tolua_S,"options","MouseSpeed",toluaI_get_enigma_options_MouseSpeed,toluaI_set_enigma_options_MouseSpeed); |
tolua_tablevar(tolua_S,"options","MouseSpeed",toluaI_get_enigma_options_MouseSpeed,toluaI_set_enigma_options_MouseSpeed); |
905 |
tolua_tablevar(tolua_S,"options","WizardMode",toluaI_get_enigma_options_WizardMode,toluaI_set_enigma_options_WizardMode); |
tolua_tablevar(tolua_S,"options","WizardMode",toluaI_get_enigma_options_WizardMode,toluaI_set_enigma_options_WizardMode); |
910 |
tolua_tablevar(tolua_S,"options","StereoSeparation",toluaI_get_enigma_options_StereoSeparation,toluaI_set_enigma_options_StereoSeparation); |
tolua_tablevar(tolua_S,"options","StereoSeparation",toluaI_get_enigma_options_StereoSeparation,toluaI_set_enigma_options_StereoSeparation); |
911 |
tolua_tablevar(tolua_S,"options","SoundSet",toluaI_get_enigma_options_SoundSet,toluaI_set_enigma_options_SoundSet); |
tolua_tablevar(tolua_S,"options","SoundSet",toluaI_get_enigma_options_SoundSet,toluaI_set_enigma_options_SoundSet); |
912 |
tolua_tablevar(tolua_S,"options","SkipSolvedLevels",toluaI_get_enigma_options_SkipSolvedLevels,toluaI_set_enigma_options_SkipSolvedLevels); |
tolua_tablevar(tolua_S,"options","SkipSolvedLevels",toluaI_get_enigma_options_SkipSolvedLevels,toluaI_set_enigma_options_SkipSolvedLevels); |
913 |
|
tolua_tablevar(tolua_S,"options","Difficulty",toluaI_get_enigma_options_Difficulty,toluaI_set_enigma_options_Difficulty); |
914 |
tolua_cclass(tolua_S,"LevelStatus",""); |
tolua_cclass(tolua_S,"LevelStatus",""); |
915 |
tolua_function(tolua_S,"LevelStatus","new",toluaI_enigma_options_LevelStatus_new00); |
tolua_function(tolua_S,"LevelStatus","new",toluaI_enigma_options_LevelStatus_new00); |
916 |
tolua_function(tolua_S,"LevelStatus","delete",toluaI_enigma_options_LevelStatus_delete00); |
tolua_function(tolua_S,"LevelStatus","delete",toluaI_enigma_options_LevelStatus_delete00); |
921 |
void tolua_enigma_close (lua_State* tolua_S) |
void tolua_enigma_close (lua_State* tolua_S) |
922 |
{ |
{ |
923 |
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"enigma"); |
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"enigma"); |
924 |
|
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"enigma"); |
925 |
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"world"); |
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"world"); |
926 |
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"video"); |
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"video"); |
|
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"display"); |
|
927 |
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"options"); |
lua_pushnil(tolua_S); lua_setglobal(tolua_S,"options"); |
928 |
} |
} |