hedgewars/uScript.pas
changeset 3736 d8982f9e7e2c
parent 3734 304a83637eb4
child 3750 3aa85b5f3318
equal deleted inserted replaced
3734:304a83637eb4 3736:d8982f9e7e2c
   593             gear^.Y:= int2hwfloat(y);
   593             gear^.Y:= int2hwfloat(y);
   594             SetAllToActive;
   594             SetAllToActive;
   595             end
   595             end
   596         end;
   596         end;
   597     lc_setgearposition:= 0
   597     lc_setgearposition:= 0
       
   598 end;
       
   599 
       
   600 function lc_setzoom(L : Plua_State) : LongInt; Cdecl;
       
   601 begin
       
   602     if lua_gettop(L) <> 1 then
       
   603         LuaError('Lua: Wrong number of parameters passed to SetZoom!')
       
   604     else
       
   605         begin
       
   606         ZoomValue:= lua_tonumber(L, 1);
       
   607         if ZoomValue < cMaxZoomLevel then ZoomValue:= cMaxZoomLevel;
       
   608         if ZoomValue > cMinZoomLevel then ZoomValue:= cMinZoomLevel;
       
   609         end;
       
   610     lc_setzoom:= 0
       
   611 end;
       
   612 
       
   613 function lc_getzoom(L : Plua_State) : LongInt; Cdecl;
       
   614 begin
       
   615     if lua_gettop(L) <> 0 then
       
   616         begin
       
   617         LuaError('Lua: Wrong number of parameters passed to GetZoom!');
       
   618         lua_pushnil(L)
       
   619         end
       
   620     else
       
   621         lua_pushnumber(L, ZoomValue);
       
   622     lc_getzoom:= 1
   598 end;
   623 end;
   599 
   624 
   600 function lc_setammo(L : Plua_State) : LongInt; Cdecl;
   625 function lc_setammo(L : Plua_State) : LongInt; Cdecl;
   601 var np: LongInt;
   626 var np: LongInt;
   602 begin
   627 begin
   930 lua_register(luaState, 'GetState', @lc_getstate);
   955 lua_register(luaState, 'GetState', @lc_getstate);
   931 lua_register(luaState, 'SetTag', @lc_settag);
   956 lua_register(luaState, 'SetTag', @lc_settag);
   932 lua_register(luaState, 'SetTimer', @lc_settimer);
   957 lua_register(luaState, 'SetTimer', @lc_settimer);
   933 lua_register(luaState, 'GetTimer', @lc_gettimer);
   958 lua_register(luaState, 'GetTimer', @lc_gettimer);
   934 lua_register(luaState, 'GetHealth', @lc_gethealth);
   959 lua_register(luaState, 'GetHealth', @lc_gethealth);
       
   960 lua_register(luaState, 'SetZoom', @lc_setzoom);
       
   961 lua_register(luaState, 'GetZoom', @lc_getzoom);
   935 
   962 
   936 
   963 
   937 ScriptClearStack; // just to be sure stack is empty
   964 ScriptClearStack; // just to be sure stack is empty
   938 ScriptLoaded:= false;
   965 ScriptLoaded:= false;
   939 end;
   966 end;