mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
Fixed a crash if calling reg_anim_obj_run_to_tile after reg_anim_combat_check.
Implemented some changes of Explosions.cpp from commit ce21fdab79 to make the code a bit more understandable.
This commit is contained in:
+11
-7
@@ -150,12 +150,16 @@ static const DWORD explosion_art_adr[] = {0x411A19, 0x411A29, 0x411A35, 0x411A3C
|
||||
static const DWORD explosion_art_defaults[] = {10, 2, 31, 29};
|
||||
static const DWORD explosion_radius_grenade = 0x479183;
|
||||
static const DWORD explosion_radius_rocket = 0x47918B;
|
||||
#define EXPL_FORCE_EXPLOSION_PATTERN (1)
|
||||
#define EXPL_FORCE_EXPLOSION_ART (2)
|
||||
#define EXPL_FORCE_EXPLOSION_RADIUS (3)
|
||||
#define EXPL_FORCE_EXPLOSION_DMGTYPE (4)
|
||||
|
||||
static const size_t numArtChecks = sizeof(explosion_art_adr) / sizeof(explosion_art_adr[0]);
|
||||
static const size_t numDmgChecks = sizeof(explosion_dmg_check_adr) / sizeof(explosion_dmg_check_adr[0]);
|
||||
|
||||
#define EXPL_FORCE_EXPLOSION_PATTERN (1)
|
||||
#define EXPL_FORCE_EXPLOSION_ART (2)
|
||||
#define EXPL_FORCE_EXPLOSION_RADIUS (3)
|
||||
#define EXPL_FORCE_EXPLOSION_DMGTYPE (4)
|
||||
|
||||
DWORD _stdcall ExplosionsMetaruleFunc(DWORD mode, DWORD arg1, DWORD arg2) {
|
||||
int i;
|
||||
switch (mode) {
|
||||
case EXPL_FORCE_EXPLOSION_PATTERN:
|
||||
if (arg1) {
|
||||
@@ -167,7 +171,7 @@ DWORD _stdcall ExplosionsMetaruleFunc(DWORD mode, DWORD arg1, DWORD arg2) {
|
||||
}
|
||||
break;
|
||||
case EXPL_FORCE_EXPLOSION_ART:
|
||||
for (i=0; i<4; i++) {
|
||||
for (int i = 0; i < numArtChecks; i++) {
|
||||
SafeWrite32(explosion_art_adr[i], (BYTE)arg1);
|
||||
}
|
||||
break;
|
||||
@@ -176,7 +180,7 @@ DWORD _stdcall ExplosionsMetaruleFunc(DWORD mode, DWORD arg1, DWORD arg2) {
|
||||
SafeWrite32(explosion_radius_rocket, arg1);
|
||||
break;
|
||||
case EXPL_FORCE_EXPLOSION_DMGTYPE:
|
||||
for (i=0; i<5; i++) {
|
||||
for (int i = 0; i < numDmgChecks; i++) {
|
||||
SafeWrite8(explosion_dmg_check_adr[i], (BYTE)arg1);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -28,7 +28,7 @@ void _stdcall RegAnimCombatCheck(DWORD newValue) {
|
||||
SafeWrite8(0x459EEB, reg_anim_combat_check); // reg_anim_obj_move_to_obj
|
||||
SafeWrite8(0x459F9F, reg_anim_combat_check); // reg_anim_obj_run_to_obj
|
||||
SafeWrite8(0x45A053, reg_anim_combat_check); // reg_anim_obj_move_to_tile
|
||||
SafeWrite8(0x45A105, reg_anim_combat_check); // reg_anim_obj_run_to_tile
|
||||
SafeWrite8(0x45A10B, reg_anim_combat_check); // reg_anim_obj_run_to_tile
|
||||
SafeWrite8(0x45AE53, reg_anim_combat_check); // reg_anim_animate_forever
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user