mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Added new HOOK_SUBCOMBATDAMAGE and refactored damage formulas code in AmmoMod.cpp (from Mr.Stalin)
This commit is contained in:
@@ -267,4 +267,49 @@
|
||||
#define WPN_ANIM_MINIGUN (0x09) // (L)
|
||||
#define WPN_ANIM_ROCKET_LAUNCHER (0x0A) // (M)
|
||||
|
||||
// Compute attack result fields
|
||||
#define C_ATTACK_SOURCE (0x00)
|
||||
#define C_ATTACK_HIT_MODE (0x04)
|
||||
#define C_ATTACK_WEAPON (0x08)
|
||||
#define C_ATTACK_DAMAGE_SOURCE (0x10) // Amount
|
||||
#define C_ATTACK_FLAGS_SOURCE (0x14) // see DAM_* values in define.h
|
||||
#define C_ATTACK_ROUNDS (0x18)
|
||||
#define C_ATTACK_TARGET (0x20)
|
||||
#define C_ATTACK_BODY_PART (0x28)
|
||||
#define C_ATTACK_DAMAGE_TARGET (0x2C) // Amount
|
||||
#define C_ATTACK_FLAGS_TARGET (0x30) // see DAM_*
|
||||
#define C_ATTACK_KNOCKBACK_VALUE (0x34)
|
||||
#define C_ATTACK_MAIN_TARGET (0x38)
|
||||
#define C_ATTACK_AROUND_NUMBER (0x3C) // The number of critters around the target
|
||||
#define C_ATTACK_TARGET1 (0x40)
|
||||
#define C_ATTACK_TARGET2 (0x44)
|
||||
#define C_ATTACK_TARGET3 (0x48)
|
||||
#define C_ATTACK_TARGET4 (0x4C)
|
||||
#define C_ATTACK_TARGET5 (0x50)
|
||||
#define C_ATTACK_TARGET6 (0x54)
|
||||
#define C_ATTACK_BODY_PART1 (0x58)
|
||||
#define C_ATTACK_BODY_PART2 (0x5C)
|
||||
#define C_ATTACK_BODY_PART3 (0x60)
|
||||
#define C_ATTACK_BODY_PART4 (0x64)
|
||||
#define C_ATTACK_BODY_PART5 (0x68)
|
||||
#define C_ATTACK_BODY_PART6 (0x6C)
|
||||
#define C_ATTACK_DAMAGE_TARGET1 (0x70) // Amount
|
||||
#define C_ATTACK_DAMAGE_TARGET2 (0x74)
|
||||
#define C_ATTACK_DAMAGE_TARGET3 (0x78)
|
||||
#define C_ATTACK_DAMAGE_TARGET4 (0x7C)
|
||||
#define C_ATTACK_DAMAGE_TARGET5 (0x80)
|
||||
#define C_ATTACK_DAMAGE_TARGET6 (0x84)
|
||||
#define C_ATTACK_FLAGS_TARGET1 (0x88) // see DAM_*
|
||||
#define C_ATTACK_FLAGS_TARGET2 (0x8C)
|
||||
#define C_ATTACK_FLAGS_TARGET3 (0x90)
|
||||
#define C_ATTACK_FLAGS_TARGET4 (0x94)
|
||||
#define C_ATTACK_FLAGS_TARGET5 (0x98)
|
||||
#define C_ATTACK_FLAGS_TARGET6 (0x9C)
|
||||
#define C_ATTACK_KNOCKBACK_VALUE1 (0xA0)
|
||||
#define C_ATTACK_KNOCKBACK_VALUE2 (0xA4)
|
||||
#define C_ATTACK_KNOCKBACK_VALUE3 (0xA8)
|
||||
#define C_ATTACK_KNOCKBACK_VALUE4 (0xAC)
|
||||
#define C_ATTACK_KNOCKBACK_VALUE5 (0xB0)
|
||||
#define C_ATTACK_KNOCKBACK_VALUE6 (0xB4)
|
||||
|
||||
#endif // DEFINE_EXTRA_H
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#define HOOK_DESCRIPTIONOBJ (34)
|
||||
#define HOOK_USESKILLON (35)
|
||||
#define HOOK_ONEXPLOSION (36)
|
||||
#define HOOK_SUBCOMBATDAMAGE (37)
|
||||
|
||||
//Valid arguments to list_begin
|
||||
#define LIST_CRITTERS (0)
|
||||
|
||||
@@ -166,7 +166,7 @@ int arg5 - The special effect flags for the target (use bwand DAM_* to chec
|
||||
int arg6 - The special effect flags for the attacker (use bwand DAM_* to check specific flags)
|
||||
int arg7 - The weapon used in the attack
|
||||
int arg8 - The bodypart that was struck
|
||||
int arg9 - Damage Multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2, but with Silent Death perk and the corresponding attack conditions, it's 4; for critical hits, the value is taken from the critical table)
|
||||
int arg9 - Damage Multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2; for critical hits, the value is taken from the critical table; with Silent Death perk and the corresponding attack conditions, the value will be doubled)
|
||||
int arg10 - Number of bullets actually hit the target (1 for melee attacks)
|
||||
int arg11 - The amount of knockback to the target
|
||||
int arg12 - Attack Type (see ATKTYPE_* constants)
|
||||
@@ -434,7 +434,7 @@ HOOK_INVENWIELD (hs_invenwield.int)
|
||||
Runs before wielding or unwielding an armor or a weapon by a critter (except when using inventory by PC).
|
||||
An example usage would be to change critter art depending on armor being used or to dynamically customize weapon animations.
|
||||
NOTE: when replacing a previously wielded armor or weapon, the unwielding hook will not be executed.
|
||||
If you need to rely on this, try checking if armor/weapon already equipped when wielding hook is executed.
|
||||
If you need to rely on this, try checking if armor/weapon is already equipped when wielding hook is executed.
|
||||
|
||||
Critter arg1 - critter
|
||||
Obj arg2 - item being wielded or unwielded (weapon/armor)
|
||||
@@ -578,3 +578,28 @@ Critter arg6 - The target critter, may be 0 or equal to the attacker
|
||||
int arg7 - 1 when using throwing weapons (e.g. grenades), 0 otherwise
|
||||
|
||||
int ret1 - overrides the found object on the checked tile, pass 0 to skip the object
|
||||
|
||||
-------------------------------------------
|
||||
|
||||
HOOK_SUBCOMBATDAMAGE (hs_subcombatdmg.int)
|
||||
|
||||
This hook overrides the vanilla damage calculation formula.
|
||||
Runs when:
|
||||
1) Before the game calculates how much damage each target will get. This includes primary target as well as all extras (explosions and bursts).
|
||||
2) AI decides whether it is safe to use area attack (burst, grenades), if he might hit friendlies.
|
||||
Does not run for misses, non-combat damage like dynamite explosions, or if one of the damage formulas is selected in ddraw.ini.
|
||||
|
||||
Critter arg1 - The attacker
|
||||
Critter arg2 - The target
|
||||
Obj arg3 - The weapon used in the attack
|
||||
int arg4 - Attack Type (see ATKTYPE_* constants)
|
||||
int arg5 - Number of bullets actually hit the target (1 for melee attacks)
|
||||
int arg6 - Target's Damage Resistance (DR) value (affected by critical hit effects, perks, traits, and special unarmed attacks)
|
||||
int arg7 - Target's Damage Threshold (DT) value (affected by critical hit effects, perks, traits, and special unarmed attacks)
|
||||
int arg8 - Bonus ranged damage from the perk
|
||||
int arg9 - Damage Multiplier (this is divided by 2, so a value of 3 does 1.5x damage, and 8 does 4x damage. Usually it's 2; for critical hits, the value is taken from the critical table; with Silent Death perk and the corresponding attack conditions, the value will be doubled)
|
||||
int arg10 - Combat Difficulty multiplier (125 - rough, 100 - normal, 75 - wimpy)
|
||||
int arg11 - The calculated amount of damage (usually 0, required when using multiple hook scripts to calculate damage and using the set_sfall_arg function)
|
||||
mixed arg12 - Computed attack results (see C_ATTACK_* for offsets and use read_int(arg12 + offset) to get the data)
|
||||
|
||||
int ret1 - The returned amount of damage
|
||||
|
||||
Reference in New Issue
Block a user