From 13b76287f8b9fc9e36064ec5e1e03a266b0c219c Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Fri, 12 Aug 2022 14:55:36 +0300 Subject: [PATCH] Add science/repair on critters patch --- src/actions.cc | 20 ++++++++++++++++++++ src/sfall_config.h | 1 + 2 files changed, 21 insertions(+) diff --git a/src/actions.cc b/src/actions.cc index b732324..a570d85 100644 --- a/src/actions.cc +++ b/src/actions.cc @@ -25,6 +25,7 @@ #include "proto_types.h" #include "random.h" #include "scripts.h" +#include "sfall_config.h" #include "skill.h" #include "stat.h" #include "text_object.h" @@ -36,6 +37,12 @@ #define MAX_KNOCKDOWN_DISTANCE 20 +typedef enum ScienceRepairTargetType { + SCIENCE_REPAIR_TARGET_TYPE_DEFAULT, + SCIENCE_REPAIR_TARGET_TYPE_DUDE, + SCIENCE_REPAIR_TARGET_TYPE_ANYONE, +} ScienceRepairTargetType; + // 0x5106D0 static int _action_in_explode = 0; @@ -1382,6 +1389,19 @@ int actionUseSkill(Object* a1, Object* a2, int skill) break; } + // SFALL: Science on critters patch. + if (1) { + int targetType = SCIENCE_REPAIR_TARGET_TYPE_DEFAULT; + configGetInt(&gSfallConfig, SFALL_CONFIG_MISC_KEY, SFALL_CONFIG_SCIENCE_REPAIR_TARGET_TYPE_KEY, &targetType); + if (targetType == SCIENCE_REPAIR_TARGET_TYPE_DUDE) { + if (a2 == gDude) { + break; + } + } else if (targetType == SCIENCE_REPAIR_TARGET_TYPE_ANYONE) { + break; + } + } + return -1; case SKILL_SNEAK: dudeToggleState(0); diff --git a/src/sfall_config.h b/src/sfall_config.h index fb974f6..fab7f92 100644 --- a/src/sfall_config.h +++ b/src/sfall_config.h @@ -52,6 +52,7 @@ #define SFALL_CONFIG_USE_DOCTOR_FRM_KEY "Doctor" #define SFALL_CONFIG_USE_SCIENCE_FRM_KEY "Science" #define SFALL_CONFIG_USE_REPAIR_FRM_KEY "Repair" +#define SFALL_CONFIG_SCIENCE_REPAIR_TARGET_TYPE_KEY "ScienceOnCritters" #define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_MULTIPLIER 1 #define SFALL_CONFIG_BURST_MOD_DEFAULT_CENTER_DIVISOR 3