1905 |
1905 |
1906 function lc_getgravity(L : Plua_State) : LongInt; Cdecl; |
1906 function lc_getgravity(L : Plua_State) : LongInt; Cdecl; |
1907 begin |
1907 begin |
1908 if lua_gettop(L) <> 0 then |
1908 if lua_gettop(L) <> 0 then |
1909 LuaParameterCountError('GetGravity', '', lua_gettop(L)) |
1909 LuaParameterCountError('GetGravity', '', lua_gettop(L)) |
1910 else |
1910 else if cGravity.isNegative then |
1911 lua_pushinteger(L, hwRound(cGravity * 50 / cWindSpeed)); |
1911 lua_pushinteger(L, hwRound(-_0_5 + (cGravity * 50 / cMaxWindSpeed))) |
|
1912 else |
|
1913 lua_pushinteger(L, hwRound( _0_5 + (cGravity * 50 / cMaxWindSpeed))); |
1912 lc_getgravity:= 1 |
1914 lc_getgravity:= 1 |
1913 end; |
1915 end; |
1914 |
1916 |
1915 function lc_setgravity(L : Plua_State) : LongInt; Cdecl; |
1917 function lc_setgravity(L : Plua_State) : LongInt; Cdecl; |
1916 begin |
1918 begin |
1917 if lua_gettop(L) <> 1 then |
1919 if lua_gettop(L) <> 1 then |
1918 LuaParameterCountError('SetGravity', 'gravity', lua_gettop(L)) |
1920 LuaParameterCountError('SetGravity', 'percent', lua_gettop(L)) |
1919 else |
1921 else |
1920 begin |
1922 begin |
1921 cGravity:= cMaxWindSpeed * lua_tointeger(L, 1) * _0_02; |
1923 cGravity:= _0_02 * lua_tointeger(L, 1) * cMaxWindSpeed; |
1922 cGravityf:= 0.00025 * lua_tointeger(L, 1) * 0.02 |
1924 cGravityf:= 0.00025 * lua_tointeger(L, 1) * 0.02 |
1923 end; |
1925 end; |
1924 lc_setgravity:= 0 |
1926 lc_setgravity:= 0 |
1925 end; |
1927 end; |
1926 |
1928 |