Added 3 new modes to metarule2_explosions and "item_make_explosive" script function (#169)

Simplified byte writing in some options (from Crafty)
Minor edits to Criticals.cpp.
Updated version number.
This commit is contained in:
NovaRain
2018-10-14 21:05:15 +08:00
parent 009a6cc21d
commit 005684fa3b
11 changed files with 323 additions and 27 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
;sfall configuration settings
;v4.1.1
;v4.1.2
[Main]
;Change to 1 if you want to use command line args to tell sfall to use another ini file.
@@ -524,7 +524,7 @@ ObjCanSeeObj_ShootThru_Fix=0
;Set to 1 to fix the broken obj_can_hear_obj script function
ObjCanHearObjFix=0
;Set to 1 to fix the mood argument of start_gdialog script function to be available for talking heads
;Set to 1 to enable the mood argument of start_gdialog script function to be available for talking heads
;If the argument value is -1, the mood will be determined by the local variable 0 of the script (vanilla behavior)
StartGDialogFix=0
+4
View File
@@ -143,6 +143,9 @@
#define set_attack_is_explosion(x) metarule2_explosions(4, x, 0)
#define set_attack_is_explosion_fire set_attack_is_explosion(DMG_fire)
#define set_explosion_radius(grenade, rocket) metarule2_explosions(5, grenade, rocket)
#define get_explosion_damage(itemPid) metarule2_explosions(6, itemPid, 0)
#define set_dynamite_damage(minDmg, maxDmg) metarule2_explosions(7, minDmg, maxDmg)
#define set_plastic_damage(minDmg, maxDmg) metarule2_explosions(8, minDmg, maxDmg)
#define GAME_MSG_COMBAT (0)
@@ -245,6 +248,7 @@
#define intface_redraw sfall_func0("intface_redraw")
#define intface_show sfall_func0("intface_show")
#define inventory_redraw(invSide) sfall_func1("inventory_redraw", invSide)
#define item_make_explosive(pid, aPid, min, max) sfall_func4("item_make_explosive", pid, aPid, min, max)
#define item_weight(obj) sfall_func1("item_weight", obj)
#define lock_is_jammed(obj) sfall_func1("lock_is_jammed", obj)
#define outlined_object sfall_func0("outlined_object")
+22 -2
View File
@@ -216,7 +216,7 @@ Some additional reg_anim_* functions were introduced. They all work in the same
> void reg_anim_turn_towards(object, tile/target, delay)
- makes object change its direction to face given tile num or target object.
> int metarule2_explosions(int arg1, int arg2, int arg3)
> int/array metarule2_explosions(int arg1, int arg2, int arg3)
was made as a dirty easy hack to allow dynamically change some explosion parameters (ranged attack). All changed parameters are reset to vanilla state automatically after each attack action. Following macros are available in sfall.h:
> void set_attack_explosion_pattern(x, y)
@@ -235,6 +235,17 @@ was made as a dirty easy hack to allow dynamically change some explosion paramet
- sets a permanent radius of the explosion for grenades and/or rockets. Passing 0 means not changing the corresponding radius.
- changed radius will be reset each time the player reloads the game.
> array get_explosion_damage(itemPid)
- returns array of the minimum and maximum damage of the explosive item.
> void set_dynamite_damage(minDmg, maxDmg)
- sets the minimum and maximum damage for Dynamite.
- changed damage will be reset each time the player reloads the game.
> void set_plastic_damage(minDmg, maxDmg)
- sets the minimum and maximum damage for Plastic Explosives.
- changed damage will be reset each time the player reloads the game.
Some utility/math functions are available:
@@ -491,6 +502,15 @@ Some utility/math functions are available:
- redraws inventory list in the inventory/use inventory item on/loot/barter screens
- invSide specifies which side needs to be redrawn: 0 - the player, 1 - target (container/NPC in loot/barter screens)
> void sfall_func3("item_make_explosive", int pid, int activePid, int damage)
> void sfall_func4("item_make_explosive", int pid, int activePid, int min, int max)
- makes the specified item (pid) an explosive item like Dynamite or Plastic Explosives
- activePid is for an item with an active timer, can be the same as the pid argument
- the item proto must be "Misc Item" type and have "Use" action flag
- min/max are the minimum and maximum explosion damage
- using the function on an item that is already set as an explosive will override its previous settings
- NOTE: this function does not work for pid's of Dynamite and Plastic Explosives
> int sfall_func1("get_string_pointer", string text)
- returns a pointer to a string variable or to a text
@@ -502,7 +522,7 @@ Some utility/math functions are available:
> void sfall_func5("create_win", string winName, int x, int y, int width, int height)
> void sfall_func6("create_win", string winName, int x, int y, int width, int height, int flags)
- works just like vanilla CreateWin function, but creates a window with MoveOnTop flag if flags argument is not specified, and allows to set additional flags for the created window
- works just like vanilla CreateWin function, but creates a window with MoveOnTop flag if the flags argument is not specified, and allows to set additional flags for the created window
- MoveOnTop flag allows the created window to be placed on top of the game interface
> void sfall_func3("set_can_rest_on_map", int mapNum, int elev, bool value)