mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added "floor2" script function to work with ceil (#109)
Added the missing description of ceil to notes.txt. Disabled ceil marco in lib.math.h. Removed duplications in Utils.h.
This commit is contained in:
@@ -26,15 +26,14 @@ end
|
||||
return intp;
|
||||
end*/
|
||||
|
||||
procedure ceil(variable val) begin
|
||||
/*procedure ceil(variable val) begin
|
||||
variable intp;
|
||||
intp := floor(val);
|
||||
if (abs(val-intp) > 0.0) then begin
|
||||
intp++;
|
||||
end
|
||||
return intp;
|
||||
end
|
||||
|
||||
end*/
|
||||
|
||||
procedure cap_number(variable num, variable min, variable max) begin
|
||||
if (num > max) then num := max;
|
||||
|
||||
@@ -213,6 +213,7 @@
|
||||
#define critter_inven_obj2(obj, type) sfall_func2("critter_inven_obj2", obj, type)
|
||||
#define display_stats sfall_func0("display_stats")
|
||||
#define exec_map_update_scripts sfall_func0("exec_map_update_scripts")
|
||||
#define floor2(value) sfall_func1("floor2", value)
|
||||
#define get_cursor_mode sfall_func0("get_cursor_mode")
|
||||
#define get_flags(obj) sfall_func1("get_flags", obj)
|
||||
#define get_ini_section(file, sect) sfall_func2("get_ini_section", file, sect)
|
||||
|
||||
@@ -265,6 +265,9 @@ Some utility/math functions are available:
|
||||
> float exponent(float x)
|
||||
- e^x
|
||||
|
||||
> int ceil(float x)
|
||||
- round x to the nearest integer that is not less than x
|
||||
|
||||
> int round(float x)
|
||||
- round x to the nearest integer
|
||||
|
||||
@@ -378,6 +381,10 @@ Some utility/math functions are available:
|
||||
- The file name is limited to 63 chars, including the extension
|
||||
- The section name is limited to 32 characters
|
||||
|
||||
> int sfall_func1("floor2", int/float value)
|
||||
- works just like vanilla floor function, but returns correct integers for negative values
|
||||
- vanilla floor function works exactly the same as ceil for negative values, much like trunc in C/C++
|
||||
|
||||
> int sfall_func1("item_weight", object)
|
||||
- gets the current weight of an object
|
||||
|
||||
|
||||
Reference in New Issue
Block a user