Small update to headers

This commit is contained in:
phobos2077
2023-05-25 02:37:51 +02:00
parent 19db722948
commit d5268f3fbc
6 changed files with 39 additions and 54 deletions
@@ -82,6 +82,7 @@
(critter_state(dude_obj) bwand DAM_CRIP_ARM_LEFT) orElse \
(critter_state(dude_obj) bwand DAM_CRIP_ARM_RIGHT))
#define get_cur_rot(cr) has_trait(TRAIT_OBJECT,cr,OBJECT_CUR_ROT)
#define dude_cur_rot (has_trait(TRAIT_OBJECT,dude_obj,OBJECT_CUR_ROT))
#define dude_inv_rot ((dude_cur_rot + 3)%6)
#define dude_tile (tile_num(dude_obj))
@@ -277,6 +277,8 @@
// critters
#define PROTO_CR_FLAGS (32) // Critter Flags
#define PROTO_CR_BASE_STATS (36) // 35 stats, see STAT_*
#define PROTO_CR_BONUS_STATS (176) // 35 stats, see STAT_*
#define PROTO_CR_BONUS_SRENGTH (176)
#define PROTO_CR_BONUS_PRCEPTION (180)
#define PROTO_CR_BONUS_ENDURANCE (184)
@@ -294,6 +296,7 @@
#define PROTO_CR_BONUS_HEALING_RATE (232)
#define PROTO_CR_BONUS_CRITICAL_CHANCE (236)
#define PROTO_CR_BONUS_BETTER_CRITICALS (240)
#define PROTO_CR_SKILLS (316) // 18 skills, see SKILL_*
#define PROTO_CR_BODY_TYPE (388)
#define PROTO_CR_KILL_EXP (392)
#define PROTO_CR_KILL_TYPE (396)
+5 -3
View File
@@ -284,7 +284,9 @@ procedure copy_array(variable src, variable srcPos, variable dest, variable dstP
end
end
// create exact copy of the array as a new temp array
/**
* Creates a shallow copy of the array as a new temp array.
*/
procedure clone_array(variable array) begin
variable new, k, v;
if (array_is_map(array)) then
@@ -399,9 +401,9 @@ procedure remove_array_set(variable array, variable item) begin
end
end
// use callback on each array element
// Transform every value in array using given callback
procedure array_map_func(variable arr, variable callback) begin
variable k, v, i;
variable k, v;
foreach (k: v in arr)
arr[k] := callback(v);
return arr;
+1
View File
@@ -3,6 +3,7 @@
#define LIB_INVEN_H
#include "define_lite.h"
#include "define_extra.h"
#define PID_BOTTLE_CAPS (41)
/**
+19 -31
View File
@@ -16,42 +16,30 @@ pure procedure unsigned_comp(variable a, variable b) begin
return 1 if ((b == 0) orElse a div b) else -1;
end
#define MAX(x, y) ((x > y) * x + (x <= y) * y)
#define MIN(x, y) ((x < y) * x + (x >= y) * y)
#define in_range(x, from, to) (x >= from and x <= to)
#define MAX(x, y) ((x > y) * x + (x <= y) * y)
#define MIN(x, y) ((x < y) * x + (x >= y) * y)
procedure max(variable x, variable y) begin
if (x > y) then return x;
return y;
end
#define math_max(x, y) (x if x > y else y)
#define math_min(x, y) (x if x < y else y)
#define in_range(x, from, to) (x >= from and x <= to)
procedure min(variable x, variable y) begin
if (x < y) then return x;
return y;
end
/*procedure round(variable val) begin
variable intp;
intp := floor(val);
if ((val-intp) >= 0.5) then intp++;
return intp;
end*/
/*procedure ceil(variable val) begin
variable intp;
intp := floor(val);
if (abs(val-intp) > 0.0) then begin
intp++;
procedure get_clamped(variable val, variable a, variable b) begin
variable min, max;
if (a < b) then begin
min := a;
max := b;
end else begin
min := b;
max := a;
end
return intp;
end*/
procedure cap_number(variable num, variable min, variable max) begin
if (num > max) then num := max;
else if (num < min) then num := min;
return num;
if (val < min) then
return min;
else if (val > max) then
return max;
else
return val;
end
#endif
+10 -20
View File
@@ -59,27 +59,17 @@ procedure hotkey_pressed_now(variable n, variable key) begin
end
end
/**
Attempt to make list_as_array safe
*/
/*procedure list_as_array_safe(variable type) begin
variable list, item, arr, i;
list := list_begin(type);
arr := temp_array(100, 4);
i := 0;
item := list_next(list);
while (item) do begin
if (len_array(arr) == i) then resize_array(arr, len_array(arr) + 100);
arr[i] := item;
item := list_next(list);
i++;
// Loads ini section as map of keys and values parsed as integers (0 values will be skipped!)
procedure get_ini_section_int_to_int(variable file, variable section, variable fixArray := false) begin
variable ar, ar2 := temp_array_map, k, v;
ar := get_ini_section(file, section);
foreach k: v in ar begin
ar2[atoi(k)] := atoi(v);
end
resize_array(arr, i);
list_end(list);
return arr;
end*/
if (fixArray) then
fix_array(ar2);
return ar2;
end
#endif