Sync header changes with develop branch

This commit is contained in:
NovaRain
2023-05-25 09:37:54 +08:00
parent 26693fd0ed
commit c33c200b51
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_LEFT) orElse \
(critter_state(dude_obj) bwand DAM_CRIP_ARM_RIGHT)) (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_cur_rot (has_trait(TRAIT_OBJECT,dude_obj,OBJECT_CUR_ROT))
#define dude_inv_rot ((dude_cur_rot + 3)%6) #define dude_inv_rot ((dude_cur_rot + 3)%6)
#define dude_tile (tile_num(dude_obj)) #define dude_tile (tile_num(dude_obj))
@@ -277,6 +277,8 @@
// critters // critters
#define PROTO_CR_FLAGS (32) // Critter Flags #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_SRENGTH (176)
#define PROTO_CR_BONUS_PRCEPTION (180) #define PROTO_CR_BONUS_PRCEPTION (180)
#define PROTO_CR_BONUS_ENDURANCE (184) #define PROTO_CR_BONUS_ENDURANCE (184)
@@ -294,6 +296,7 @@
#define PROTO_CR_BONUS_HEALING_RATE (232) #define PROTO_CR_BONUS_HEALING_RATE (232)
#define PROTO_CR_BONUS_CRITICAL_CHANCE (236) #define PROTO_CR_BONUS_CRITICAL_CHANCE (236)
#define PROTO_CR_BONUS_BETTER_CRITICALS (240) #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_BODY_TYPE (388)
#define PROTO_CR_KILL_EXP (392) #define PROTO_CR_KILL_EXP (392)
#define PROTO_CR_KILL_TYPE (396) #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
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 procedure clone_array(variable array) begin
variable new, k, v; variable new, k, v;
if (array_is_map(array)) then if (array_is_map(array)) then
@@ -399,9 +401,9 @@ procedure remove_array_set(variable array, variable item) begin
end end
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 procedure array_map_func(variable arr, variable callback) begin
variable k, v, i; variable k, v;
foreach (k: v in arr) foreach (k: v in arr)
arr[k] := callback(v); arr[k] := callback(v);
return arr; return arr;
+1
View File
@@ -3,6 +3,7 @@
#define LIB_INVEN_H #define LIB_INVEN_H
#include "define_lite.h" #include "define_lite.h"
#include "define_extra.h"
#define PID_BOTTLE_CAPS (41) #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; return 1 if ((b == 0) orElse a div b) else -1;
end end
#define MAX(x, y) ((x > y) * x + (x <= y) * y) #define MAX(x, y) ((x > y) * x + (x <= y) * y)
#define MIN(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)
procedure max(variable x, variable y) begin #define math_max(x, y) (x if x > y else y)
if (x > y) then return x; #define math_min(x, y) (x if x < y else y)
return y; #define in_range(x, from, to) (x >= from and x <= to)
end
procedure min(variable x, variable y) begin
if (x < y) then return x;
return y;
end
/*procedure round(variable val) begin procedure get_clamped(variable val, variable a, variable b) begin
variable intp; variable min, max;
intp := floor(val); if (a < b) then begin
if ((val-intp) >= 0.5) then intp++; min := a;
return intp; max := b;
end*/ end else begin
min := b;
/*procedure ceil(variable val) begin max := a;
variable intp;
intp := floor(val);
if (abs(val-intp) > 0.0) then begin
intp++;
end end
return intp; if (val < min) then
end*/ return min;
else if (val > max) then
procedure cap_number(variable num, variable min, variable max) begin return max;
if (num > max) then num := max; else
else if (num < min) then num := min; return val;
return num;
end end
#endif #endif
+10 -20
View File
@@ -59,27 +59,17 @@ procedure hotkey_pressed_now(variable n, variable key) begin
end end
end end
// 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;
Attempt to make list_as_array safe ar := get_ini_section(file, section);
*/ foreach k: v in ar begin
/*procedure list_as_array_safe(variable type) begin ar2[atoi(k)] := atoi(v);
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++;
end end
resize_array(arr, i); if (fixArray) then
list_end(list); fix_array(ar2);
return arr; return ar2;
end*/ end
#endif #endif