Fixed broken get_attack_type function (from Mr.Stalin and Crafty)

Replaced some SafeWriteX usages with SafeMemSet for writing serial NOPs.
Minor edits to documents.
This commit is contained in:
NovaRain
2018-05-08 15:39:39 +08:00
parent e92ded34e4
commit 9b67db7208
6 changed files with 48 additions and 40 deletions
+12 -12
View File
@@ -77,7 +77,7 @@ The defines to use for the hooktype are in sfall.h.
HOOK_TOHIT (hs_tohit.int)
Runs when fallout is calculating the chances of an attack striking a target
Runs when Fallout is calculating the chances of an attack striking a target
Runs after the hit chance is fully calculated normally, including applying the 95% cap
int arg1 - The unmodified hit chance
@@ -94,7 +94,7 @@ int ret1 - the new hit chance
HOOK_AFTERHITROLL (hs_afterhitroll.int)
Runs after fallout has decided if an attack will hit or miss
Runs after Fallout has decided if an attack will hit or miss
int arg1 - If the attack will hit. (0 - critical miss, 1 - miss, 2 - hit, 3 - critical hit)
critter arg2 - The attacker
@@ -110,22 +110,22 @@ critter ret3 - Override the target of the attack
HOOK_CALCAPCOST (hs_calcapcost.int)
Runs whenever fallout is calculating the ap cost of using the weapon (or unarmed attack). Doesn't run for using other item types or moving.
Note that the first time a game is loaded, this script doesn't run before the initial interface is drawn, so if the script effects the ap cost of whatever is in the players hands at the time the wrong ap cost will be shown. It will be fixed the next time the interface is redrawn.
Runs whenever Fallout is calculating the AP cost of using the weapon (or unarmed attack). Doesn't run for using other item types or moving.
Note that the first time a game is loaded, this script doesn't run before the initial interface is drawn, so if the script effects the AP cost of whatever is in the players hands at the time the wrong AP cost will be shown. It will be fixed the next time the interface is redrawn.
You can get the weapon object by checking item slot based on attack type (ATKTYPE_LWEP1, ATKTYPE_LWEP2, etc) and then calling critter_inven_obj().
critter arg1 - The critter performing the action
int arg2 - Attack Type (see ATKTYPE_* constants)
int arg3 - Is aimed attack (1 or 0)
int arg4 - The normal ap cost
int arg4 - The normal AP cost
int ret1 - The new ap cost
int ret1 - The new AP cost
-------------------------------------------
HOOK_DEATHANIM1 (hs_deathanim1.int)
Runs before fallout tries to calculate the death animation. Lets you switch out which weapon fallout sees
Runs before Fallout tries to calculate the death animation. Lets you switch out which weapon Fallout sees
int arg1 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
critter arg2 - The attacker
@@ -138,14 +138,14 @@ int ret1 - The pid of an object to override the attacking weapon with
HOOK_DEATHANIM2 (hs_deathanim2.int)
Runs after fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than hs_deathanim1, but performs no validation.
Runs after Fallout has calculated the death animation. Lets you set your own custom frame id, so more powerful than hs_deathanim1, but performs no validation.
When using critter_dmg function, this script will also run. In that case weapon pid will be -1 and target will point to an object with obj_art_fid == 0x20001F5.
item arg1 - The pid of the weapon performing the attack. (May be -1 if the attack is unarmed)
critter arg2 - The attacker
critter arg3 - The target
int arg4 - The amount of damage
int arg5 - The death anim id calculated by fallout
int arg5 - The death anim id calculated by Fallout
int ret1 - The death anim id to override with
@@ -271,13 +271,13 @@ int ret1 - the modified value of all of the goods
HOOK_MOVECOST (hs_movecost.int)
Runs when calculating the ap cost of movement
Runs when calculating the AP cost of movement
Critter arg1 - the critter doing the moving
int arg2 - the number of hexes being moved
int arg3 - the original ap cost
int arg3 - the original AP cost
int ret1 - the new ap cost
int ret1 - the new AP cost
-------------------------------------------
+2 -2
View File
@@ -157,7 +157,7 @@ array - array ID to be used with array-related functions (actually an integer)
- if you add 0x80000000 to the sid when calling set_script, map_enter_p_proc will be SKIPPED. The start proc will always be run.
> int get_script(object)
- accepts a pointer to an object and returns it's scriptID (line number in scripts.lst), or -1 if the object is unscripted.
- accepts a pointer to an object and returns its scriptID (line number in scripts.lst), or -1 if the object is unscripted.
> void set_self(int obj)
- overrides the scripts self_obj for the next function call.
@@ -214,7 +214,7 @@ Some additional reg_anim_* functions were introduced. They all work in the same
- plays "take out weapon" animation for given holdFrameID. It is not required to have such weapon in critter's inventory.
> void reg_anim_turn_towards(object, tile/target, delay)
- makes object change it's direction to face given tile num or target object.
- makes object change its direction to face given tile num or target object.
> int metarule2_explosions(int arg1, int arg2)
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: