From edd58c8925946b28e3b771b2b5eb8e92e9197197 Mon Sep 17 00:00:00 2001 From: Jonaeru Date: Sun, 30 Mar 2025 22:31:51 +0900 Subject: [PATCH] Fix offset in weapon set by adding IR Scanner and Night Vision --- port/src/preprocess/misc.c | 12 ++++++++++-- src/include/constants.h | 28 +++++++++++++++------------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/port/src/preprocess/misc.c b/port/src/preprocess/misc.c index c3361e90b..23e345266 100644 --- a/port/src/preprocess/misc.c +++ b/port/src/preprocess/misc.c @@ -57,18 +57,26 @@ u8 *preprocessMpConfigs(u8* data, u32 size, u32* outSize) for (s32 j = 0; j < ARRAYCOUNT(cfg->setup.weapons); ++j) { #if VERSION == VERSION_JPN_FINAL /* TODO: replace with runtime check */ if (cfg->setup.weapons[j] >= 0x24) { - // weapons after and including the shield need to be shifted + // weapons after and including the shield need to be shifted (for classic weapons) cfg->setup.weapons[j] += (MPWEAPON_SHIELD - MPWEAPON_PP9I); } + if (cfg->setup.weapons[j] >= 0x22) { + // weapons after and including the cloaking device need to be shifted (for IR Scanner and Night Vision) + cfg->setup.weapons[j] += (MPWEAPON_CLOAKINGDEVICE - MPWEAPON_NIGHTVISION); + } if (cfg->setup.weapons[j] >= 0x19) { // weapons after the combat knife also need to be shifted up in JPN cfg->setup.weapons[j]++; } #else - // in other versions we only care about the shield and above if (cfg->setup.weapons[j] >= 0x25) { + // weapons after and including the shield need to be shifted (for classic weapons) cfg->setup.weapons[j] += (MPWEAPON_SHIELD - MPWEAPON_PP9I); } + if (cfg->setup.weapons[j] >= 0x23) { + // weapons after and including the cloaking device need to be shifted (for IR Scanner and Night Vision) + cfg->setup.weapons[j] += (MPWEAPON_CLOAKINGDEVICE - MPWEAPON_NIGHTVISION); + } #endif } } diff --git a/src/include/constants.h b/src/include/constants.h index 32452ddab..2ff7b0658 100644 --- a/src/include/constants.h +++ b/src/include/constants.h @@ -2993,7 +2993,7 @@ #define MPWEAPON_SHIELD (VERSION == VERSION_JPN_FINAL ? 0x24 : 0x25) #define MPWEAPON_DISABLED (VERSION == VERSION_JPN_FINAL ? 0x25 : 0x26) #define NUM_MPWEAPONS (VERSION == VERSION_JPN_FINAL ? 0x26 : 0x27) -#else // add all classic weapons to multiplayer and allow combat knife in JPN +#else // add all classic weapons to multiplayer and allow combat knife in JPN and add IR Scanner and Night Vision #define MPWEAPON_COMBATKNIFE 0x19 #define MPWEAPON_CROSSBOW 0x1a #define MPWEAPON_TRANQUILIZER 0x1b @@ -3004,18 +3004,20 @@ #define MPWEAPON_REMOTEMINE 0x20 #define MPWEAPON_LASER 0x21 #define MPWEAPON_XRAYSCANNER 0x22 -#define MPWEAPON_CLOAKINGDEVICE 0x23 -#define MPWEAPON_COMBATBOOST 0x24 -#define MPWEAPON_PP9I 0x25 -#define MPWEAPON_CC13 0x26 -#define MPWEAPON_KL01313 0x27 -#define MPWEAPON_KF7SPECIAL 0x28 -#define MPWEAPON_ZZT 0x29 -#define MPWEAPON_DMC 0x2a -#define MPWEAPON_AR53 0x2b -#define MPWEAPON_RCP45 0x2c -#define MPWEAPON_SHIELD 0x2d -#define MPWEAPON_DISABLED 0x2e +#define MPWEAPON_NIGHTVISION 0x23 +#define MPWEAPON_IRSCANNER 0x24 +#define MPWEAPON_CLOAKINGDEVICE 0x25 +#define MPWEAPON_COMBATBOOST 0x26 +#define MPWEAPON_PP9I 0x27 +#define MPWEAPON_CC13 0x28 +#define MPWEAPON_KL01313 0x29 +#define MPWEAPON_KF7SPECIAL 0x2a +#define MPWEAPON_ZZT 0x2b +#define MPWEAPON_DMC 0x2c +#define MPWEAPON_AR53 0x2d +#define MPWEAPON_RCP45 0x2e +#define MPWEAPON_SHIELD 0x2f +#define MPWEAPON_DISABLED 0x30 #define NUM_MPWEAPONS 0x31 #endif