Added get_tile_fid and macros to function notes

Some misc edits to documents.
This commit is contained in:
NovaRain
2023-06-13 12:32:49 +08:00
parent 492e31410c
commit 46a80fdb6a
9 changed files with 44 additions and 24 deletions
+2 -2
View File
@@ -22,7 +22,7 @@ UseCommandLine=0
;Starting from 4.2.6, the game will automatically search and load custom .dat files (or folders named as .dat files) from <GameRoot>\mods\ ;Starting from 4.2.6, the game will automatically search and load custom .dat files (or folders named as .dat files) from <GameRoot>\mods\
;The load order of files in the folder will be in reverse alphabetical order of the filenames ;The load order of files in the folder will be in reverse alphabetical order of the filenames
;Autoloaded files will have a higher priority than the files specified in the PatchFileXX options ;Autoloaded files will have a higher priority than the files specified in the PatchFileXX options
;The complete data load order is: ;The complete order of how the engine finds game data is:
;master_patches > critter_patches > mods > PatchFile99..PatchFile0 > patchXXX.dat > sfall.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat ;master_patches > critter_patches > mods > PatchFile99..PatchFile0 > patchXXX.dat > sfall.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat
;PatchFile0=mods\RP_data ;PatchFile0=mods\RP_data
;PatchFile1= ;PatchFile1=
@@ -286,7 +286,7 @@ UseFileSystemOverride=0
;If you want to load multiple patch files (up to 1000) at once, you can include a %d in the file name (sprintf syntax) ;If you want to load multiple patch files (up to 1000) at once, you can include a %d in the file name (sprintf syntax)
;PatchFile=patch%03d.dat ;PatchFile=patch%03d.dat
;Set to 1 to use the modified data load order for the engine to find game data ;Set to 1 to change the order of how the engine finds game data
;Original: patchXXX.dat > critter_patches > critter_dat > f2_res_patches > f2_res_dat > master_patches > master_dat ;Original: patchXXX.dat > critter_patches > critter_dat > f2_res_patches > f2_res_dat > master_patches > master_dat
;Modified: master_patches > critter_patches > extra_patches > patchXXX.dat > sfall.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat ;Modified: master_patches > critter_patches > extra_patches > patchXXX.dat > sfall.dat > critter_dat > f2_res_patches > f2_res_dat > master_dat
;This option is always enabled in 4.3/3.8.30 or later. The information is left for reference only ;This option is always enabled in 4.3/3.8.30 or later. The information is left for reference only
+9 -7
View File
@@ -791,7 +791,7 @@
opcode: 0x825f opcode: 0x825f
- name: reg_anim_turn_towards - name: reg_anim_turn_towards
detail: void reg_anim_turn_towards(ObjectPtr, int tile/target, delay) detail: void reg_anim_turn_towards(ObjectPtr, int tile/target, delay)
doc: Makes object change its direction to face given tile num or target object. doc: Makes object change its direction to face given tile number or target object.
opcode: 0x8260 opcode: 0x8260
- name: reg_anim_callback - name: reg_anim_callback
detail: void reg_anim_callback(procedure proc) detail: void reg_anim_callback(procedure proc)
@@ -825,9 +825,9 @@
- name: get_tile_fid - name: get_tile_fid
detail: int get_tile_fid(int tileData) detail: int get_tile_fid(int tileData)
doc: | doc: |
- returns FID information about the square under the given tile at elevation 0 - Returns FID information about the square under the given tile at elevation 0
- pass elevation as 4-bit number in bits 25-28 to access other elevations - Pass elevation as 4-bit number in bits 25-28 to access other elevations
- pass result mode in bits 29-32: 0 - Ground FID, 1 - Roof FID, 2 - Raw data. - Pass result mode in bits 29-32: 0 - ground FID, 1 - roof FID, 2 - raw data.
opcode: 0x823a opcode: 0x823a
- name: tile_under_cursor - name: tile_under_cursor
detail: int tile_under_cursor detail: int tile_under_cursor
@@ -856,11 +856,11 @@
macro: sfall.h macro: sfall.h
- name: get_tile_ground_fid - name: get_tile_ground_fid
detail: int get_tile_ground_fid(int tileNum, int elevation) detail: int get_tile_ground_fid(int tileNum, int elevation)
doc: Returns FID of a ground tile at given tileNum and elevation. doc: Returns FID of a ground tile at given tile number and elevation.
macro: sfall.h macro: sfall.h
- name: get_tile_roof_fid - name: get_tile_roof_fid
detail: int get_tile_roof_fid(int tileNum, int elevation) detail: int get_tile_roof_fid(int tileNum, int elevation)
doc: Returns FID of a roof tile at given tileNum and elevation. Note that FID of 1 is used when there is no actual roof. doc: Returns FID of a roof tile at given tile number and elevation. Note that FID of 1 is used when there is no actual roof.
macro: sfall.h macro: sfall.h
- name: obj_blocking_line - name: obj_blocking_line
@@ -1110,7 +1110,9 @@
opcode: 0x8251 opcode: 0x8251
- name: get_string_pointer - name: get_string_pointer
detail: int get_string_pointer(string text) detail: int get_string_pointer(string text)
doc: Returns a pointer to a string variable or to a text. DEPRECATED, just use normal strings instead. doc: |
(DEPRECATED) Returns a pointer to a string variable or to a text
- __NOTE:__ this function is intended for use only in `HOOK_DESCRIPTIONOBJ`. Starting from sfall 4.3.9/3.8.39, you can return normal strings directly in the hook without calling the function
macro: sfall.h macro: sfall.h
- name: string_format - name: string_format
detail: string string_format(string format, any val1, any val2, ...) detail: string string_format(string format, any val1, any val2, ...)
+1 -2
View File
@@ -51,10 +51,9 @@ procedure remove_items_pid(variable invenObj, variable itemPid, variable quantit
variable begin variable begin
item; item;
toRemoveQty; toRemoveQty;
numRemoved;
end end
if (not(invenObj)) then return; if (not(invenObj)) then return;
toRemoveQty := obj_is_carrying_obj_pid(invenObj,itemPid); toRemoveQty := obj_is_carrying_obj_pid(invenObj, itemPid);
if (quantity < toRemoveQty and quantity != -1) then begin if (quantity < toRemoveQty and quantity != -1) then begin
toRemoveQty := quantity; toRemoveQty := quantity;
end end
+4 -3
View File
@@ -275,6 +275,10 @@
#define weapon_attack_mode2(pid) ((get_proto_data(pid, PROTO_FLAG_EXT) bwand 0x000000F0) / 0x10) #define weapon_attack_mode2(pid) ((get_proto_data(pid, PROTO_FLAG_EXT) bwand 0x000000F0) / 0x10)
#define weapon_attack_mode(pid, attackType) (weapon_attack_mode1(pid) if (attackType == ATKTYPE_LWEP1 or attackType == ATKTYPE_RWEP1) else weapon_attack_mode2(pid)) #define weapon_attack_mode(pid, attackType) (weapon_attack_mode1(pid) if (attackType == ATKTYPE_LWEP1 or attackType == ATKTYPE_RWEP1) else weapon_attack_mode2(pid))
#define get_tile_fid_ext(tile, elev, mode) get_tile_fid(((mode bwand 0xF) * 0x10000000) bwor ((elev bwand 0xF) * 0x1000000) bwor (tile bwand 0xFFFFFF))
#define get_tile_ground_fid(tile, elev) get_tile_fid_ext(tile, elev, 0)
#define get_tile_roof_fid(tile, elev) get_tile_fid_ext(tile, elev, 1)
/* SFALL_FUNCX MACROS */ /* SFALL_FUNCX MACROS */
@@ -321,9 +325,6 @@
#define get_npc_stat_max(stat) sfall_func2("get_stat_max", stat, 1) #define get_npc_stat_max(stat) sfall_func2("get_stat_max", stat, 1)
#define get_npc_stat_min(stat) sfall_func2("get_stat_min", stat, 1) #define get_npc_stat_min(stat) sfall_func2("get_stat_min", stat, 1)
#define get_sfall_arg_at(argNum) sfall_func1("get_sfall_arg_at", argNum) #define get_sfall_arg_at(argNum) sfall_func1("get_sfall_arg_at", argNum)
#define get_tile_fid_ext(tile, elev, mode) get_tile_fid(((mode bwand 0xF) * 0x10000000) bwor ((elev bwand 0xF) * 0x1000000) bwor (tile bwand 0xFFFFFF))
#define get_tile_ground_fid(tile, elev) get_tile_fid_ext(tile, elev, 0)
#define get_tile_roof_fid(tile, elev) get_tile_fid_ext(tile, elev, 1)
#define get_terrain_name(x, y) sfall_func2("get_terrain_name", x, y) #define get_terrain_name(x, y) sfall_func2("get_terrain_name", x, y)
#define get_text_width(text) sfall_func1("get_text_width", text) #define get_text_width(text) sfall_func1("get_text_width", text)
#define has_fake_perk_npc(npc, perk) sfall_func2("has_fake_perk_npc", npc, perk) #define has_fake_perk_npc(npc, perk) sfall_func2("has_fake_perk_npc", npc, perk)
+4 -2
View File
@@ -607,10 +607,12 @@
Does not run if the script of the object overrides the description. Does not run if the script of the object overrides the description.
__NOTE:__ Returning a pointer to the new text received from the `get_string_pointer` function is still valid, but the method is DEPRECATED and is left for backward compatibility only.
``` ```
Obj arg0 - the object Obj arg0 - the object
str ret0 - new description text to use String ret0 - the new description text to use
``` ```
- name: UseSkillOn - name: UseSkillOn
@@ -809,7 +811,7 @@
Critter arg0 - the critter doing the check Critter arg0 - the critter doing the check
Item arg1 - the weapon being checked Item arg1 - the weapon being checked
int arg2 - attack type (see ATKTYPE_* constants) int arg2 - attack type (see ATKTYPE_* constants)
int arg3 - original result of engine function: 1 - can use, 0 - can't use int arg3 - original result of engine function: 1 - can use, 0 - cannot use
int ret0 - overrides the result of engine function. Any non-zero value allows using the weapon int ret0 - overrides the result of engine function. Any non-zero value allows using the weapon
``` ```
+4 -2
View File
@@ -691,10 +691,12 @@ An example usage would be to add an additional description to the item based on
Does not run if the script of the object overrides the description. Does not run if the script of the object overrides the description.
__NOTE:__ Returning a pointer to the new text received from the `get_string_pointer` function is still valid, but the method is DEPRECATED and is left for backward compatibility only.
``` ```
Obj arg0 - the object Obj arg0 - the object
str ret0 - new description text to use String ret0 - the new description text to use
``` ```
------------------------------------------- -------------------------------------------
@@ -926,7 +928,7 @@ For the player, this happens when the game updates the item data for active item
Critter arg0 - the critter doing the check Critter arg0 - the critter doing the check
Item arg1 - the item being checked Item arg1 - the item being checked
int arg2 - attack type (see ATKTYPE_* constants), or -1 for dude_obj int arg2 - attack type (see ATKTYPE_* constants), or -1 for dude_obj
int arg3 - original result of engine function: 1 - can use, 0 - can't use int arg3 - original result of engine function: 1 - can use, 0 - cannot use
int ret0 - overrides the result of engine function. Any non-zero value allows using the weapon int ret0 - overrides the result of engine function. Any non-zero value allows using the weapon
``` ```
+17 -3
View File
@@ -230,6 +230,20 @@ FUNCTION REFERENCE
##### `void set_critter_pickpocket_mod(object critter, int max, int mod)` ##### `void set_critter_pickpocket_mod(object critter, int max, int mod)`
- The same as above, but applies only to specific critter. - The same as above, but applies only to specific critter.
-----
##### `int get_tile_fid(int tileData)`
- Returns FID information about the square under the given tile at elevation 0.
- Pass elevation as 4-bit number in bits 25-28 to access other elevations.
- Pass result mode in bits 29-32: 0 - ground FID, 1 - roof FID, 2 - raw data. Following macros are available in **sfall.h**:
-----
##### `int get_tile_ground_fid(int tileNum, int elevation)`
- Returns FID of a ground tile at given tile number and elevation.
-----
##### `int get_tile_roof_fid(int tileNum, int elevation)`
- Returns FID of a roof tile at given tile number and elevation. Note that FID of 1 is used when there is no actual roof.
----- -----
##### `void reg_anim_combat_check` ##### `void reg_anim_combat_check`
- Allows enabling all `reg_anim_*` functions in combat (including vanilla functions) if set to 0. It is automatically reset at the end of each frame, so you need to call it before `reg_anim_begin() ... reg_anim_end()` code block. - Allows enabling all `reg_anim_*` functions in combat (including vanilla functions) if set to 0. It is automatically reset at the end of each frame, so you need to call it before `reg_anim_begin() ... reg_anim_end()` code block.
@@ -257,7 +271,7 @@ FUNCTION REFERENCE
----- -----
##### `void reg_anim_turn_towards(object, tile/target, delay)` ##### `void reg_anim_turn_towards(object, tile/target, delay)`
- Makes object change its direction to face given tile num or target object. - Makes object change its direction to face given tile number or target object.
----- -----
##### `void reg_anim_callback(procedure proc)` ##### `void reg_anim_callback(procedure proc)`
@@ -706,8 +720,8 @@ sfall_funcX metarule functions
---- ----
#### get_string_pointer #### get_string_pointer
`int sfall_func1("get_string_pointer", string text)` `int sfall_func1("get_string_pointer", string text)`
- DEPRECATED, use normal strings - (DEPRECATED) Returns a pointer to a string variable or to a text
- Returns a pointer to a string variable or to a text - __NOTE:__ this function is intended for use only in `HOOK_DESCRIPTIONOBJ`. Starting from sfall 4.3.9/3.8.39, you can return normal strings directly in the hook without calling the function
---- ----
#### dialog_message #### dialog_message
+1 -1
View File
@@ -310,7 +310,7 @@ _^ - These functions require AllowUnsafeScripting to be enabled in ddraw.ini_
0x8251 - `int charcode(string string)`\ 0x8251 - `int charcode(string string)`\
0x8253 - `int typeof(any value)` 0x8253 - `int typeof(any value)`
0x823a - `int get_tile_fid(int tile)` 0x823a - `int get_tile_fid(int tileData)`
0x823b - `int modified_ini()` 0x823b - `int modified_ini()`
+2 -2
View File
@@ -310,9 +310,9 @@
0x8251 - int charcode(string string) 0x8251 - int charcode(string string)
0x8253 - int typeof(any value) 0x8253 - int typeof(any value)
0x823a - int get_tile_fid(int tile) 0x823a - int get_tile_fid(int tileData)
0x823b - int modified_ini 0x823b - int modified_ini()
0x823e - void force_aimed_shots(int pid) 0x823e - void force_aimed_shots(int pid)
0x823f - void disable_aimed_shots(int pid) 0x823f - void disable_aimed_shots(int pid)