hedgewars/uScript.pas
changeset 13062 bcb87269867e
parent 13038 356995c8c48b
child 13088 2b5314cc356c
equal deleted inserted replaced
13061:8d2087c85b8d 13062:bcb87269867e
  2512         lua_pushnil(L); // return value on stack (nil)
  2512         lua_pushnil(L); // return value on stack (nil)
  2513     lc_getrandom:= 1
  2513     lc_getrandom:= 1
  2514 end;
  2514 end;
  2515 
  2515 
  2516 function lc_setwind(L : Plua_State) : LongInt; Cdecl;
  2516 function lc_setwind(L : Plua_State) : LongInt; Cdecl;
       
  2517 var vg: PVisualGear;
  2517 begin
  2518 begin
  2518     if CheckLuaParamCount(L, 1, 'SetWind', 'windSpeed') then
  2519     if CheckLuaParamCount(L, 1, 'SetWind', 'windSpeed') then
  2519         begin
  2520         begin
  2520         cWindSpeed:= int2hwfloat(Trunc(lua_tonumber(L, 1))) / 100 * cMaxWindSpeed;
  2521         cWindSpeed:= int2hwfloat(Trunc(lua_tonumber(L, 1))) / 100 * cMaxWindSpeed;
  2521         cWindSpeedf:= SignAs(cWindSpeed,cWindSpeed).QWordValue / SignAs(_1,_1).QWordValue;
  2522         cWindSpeedf:= SignAs(cWindSpeed,cWindSpeed).QWordValue / SignAs(_1,_1).QWordValue;
  2522         if cWindSpeed.isNegative then
  2523         if cWindSpeed.isNegative then
  2523             CWindSpeedf := -cWindSpeedf;
  2524             cWindSpeedf := -cWindSpeedf;
  2524         AddVisualGear(0, 0, vgtSmoothWindBar);
  2525         vg:= AddVisualGear(0, 0, vgtSmoothWindBar);
       
  2526         if vg <> nil then vg^.dAngle:= hwFloat2Float(cWindSpeed);
       
  2527             AddFileLog('Wind = '+FloatToStr(cWindSpeed));
  2525         end;
  2528         end;
  2526     lc_setwind:= 0
  2529     lc_setwind:= 0
  2527 end;
  2530 end;
  2528 
  2531 
  2529 function lc_getwind(L : Plua_State) : LongInt; Cdecl;
  2532 function lc_getwind(L : Plua_State) : LongInt; Cdecl;