Skip to content

Commit

Permalink
Merge branch 'port' of https://github.com/fgsfdsfgs/perfect_dark into…
Browse files Browse the repository at this point in the history
… port-debugger
  • Loading branch information
fgsfdsfgs committed Mar 9, 2024
2 parents 20534a7 + c9f880e commit 804674e
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 17 deletions.
17 changes: 14 additions & 3 deletions port/src/preprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,12 +1045,23 @@ void preprocessMpConfigs(u8 *data, u32 size)
// TODO: are these required or are they always 0?
PD_SWAP_VAL(cfg->setup.fileguid.deviceserial);
PD_SWAP_VAL(cfg->setup.fileguid.fileid);
// convert MPWEAPON_ to take classic weapons into account
// convert MPWEAPON_ to take classic weapons and JPN weapons into account
for (s32 j = 0; j < ARRAYCOUNT(cfg->setup.weapons); ++j) {
// old MPWEAPON_SHIELD (0x24/0x25) and above are affected
if (cfg->setup.weapons[j] >= MPWEAPON_PP9I) {
#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
cfg->setup.weapons[j] += (MPWEAPON_SHIELD - MPWEAPON_PP9I);
}
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) {
cfg->setup.weapons[j] += (MPWEAPON_SHIELD - MPWEAPON_PP9I);
}
#endif
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/mplayer/mplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1505,7 +1505,7 @@ struct mpweaponset g_MpWeaponSets[12] = {
{ /*0x08*/ L_MPWEAPONS_047, { WEAPON_MAGSEC4, WEAPON_CMP150, WEAPON_AR34, WEAPON_DEVASTATOR, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_DEVASTATOR, 0, 0, 0 }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // Grenade Launcher
{ /*0x09*/ L_MPWEAPONS_046, { WEAPON_MAULER, WEAPON_CYCLONE, WEAPON_DRAGON, WEAPON_ROCKETLAUNCHER, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_MAULER, 0, 0, 0 }, WEAPON_FALCON2, WEAPON_CYCLONE, WEAPON_DRAGON, WEAPON_ROCKETLAUNCHER, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Rocket Launcher
{ /*0x0a*/ L_MPWEAPONS_045, { WEAPON_MAGSEC4, WEAPON_LAPTOPGUN, WEAPON_K7AVENGER, WEAPON_PROXIMITYMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_LAPTOPGUN, MPFEATURE_WEAPON_K7AVENGER, MPFEATURE_WEAPON_PROXIMITYMINE, 0 }, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED, WEAPON_DISABLED }, // Proximity Mine
#if VERSION == VERSION_JPN_FINAL
#if (VERSION == VERSION_JPN_FINAL) && defined(PLATFORM_N64)
{ /*0x0b*/ L_MPWEAPONS_044, { WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_CROSSBOW, 0, 0, 0 }, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Close Combat
#else
{ /*0x0b*/ L_MPWEAPONS_044, { WEAPON_COMBATKNIFE, WEAPON_COMBATKNIFE, WEAPON_TIMEDMINE, WEAPON_CROSSBOW, WEAPON_MPSHIELD, WEAPON_DISABLED }, { MPFEATURE_WEAPON_CROSSBOW, 0, 0, 0 }, WEAPON_COMBATKNIFE, WEAPON_COMBATKNIFE, WEAPON_TIMEDMINE, WEAPON_TIMEDMINE, WEAPON_MPSHIELD, WEAPON_DISABLED }, // Close Combat
Expand Down
38 changes: 25 additions & 13 deletions src/include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -2969,23 +2969,35 @@
#define MPWEAPON_DEVASTATOR 0x16
#define MPWEAPON_ROCKETLAUNCHER 0x17
#define MPWEAPON_SLAYER 0x18
#define MPWEAPON_COMBATKNIFE (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0 : 0x19)
#define MPWEAPON_CROSSBOW (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x19 : 0x1a)
#define MPWEAPON_TRANQUILIZER (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x1a : 0x1b)
#define MPWEAPON_GRENADE (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x1b : 0x1c)
#define MPWEAPON_NBOMB (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x1c : 0x1d)
#define MPWEAPON_TIMEDMINE (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x1d : 0x1e)
#define MPWEAPON_PROXIMITYMINE (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x1e : 0x1f)
#define MPWEAPON_REMOTEMINE (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x1f : 0x20)
#define MPWEAPON_LASER (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x20 : 0x21)
#define MPWEAPON_XRAYSCANNER (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x21 : 0x22)
#define MPWEAPON_CLOAKINGDEVICE (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x22 : 0x23)
#define MPWEAPON_COMBATBOOST (VERSION == VERSION_JPN_FINAL && defined(PLATFORM_N64) ? 0x23 : 0x24)
#ifdef PLATFORM_N64
#define MPWEAPON_COMBATKNIFE (VERSION == VERSION_JPN_FINAL ? 0 : 0x19)
#define MPWEAPON_CROSSBOW (VERSION == VERSION_JPN_FINAL ? 0x19 : 0x1a)
#define MPWEAPON_TRANQUILIZER (VERSION == VERSION_JPN_FINAL ? 0x1a : 0x1b)
#define MPWEAPON_GRENADE (VERSION == VERSION_JPN_FINAL ? 0x1b : 0x1c)
#define MPWEAPON_NBOMB (VERSION == VERSION_JPN_FINAL ? 0x1c : 0x1d)
#define MPWEAPON_TIMEDMINE (VERSION == VERSION_JPN_FINAL ? 0x1d : 0x1e)
#define MPWEAPON_PROXIMITYMINE (VERSION == VERSION_JPN_FINAL ? 0x1e : 0x1f)
#define MPWEAPON_REMOTEMINE (VERSION == VERSION_JPN_FINAL ? 0x1f : 0x20)
#define MPWEAPON_LASER (VERSION == VERSION_JPN_FINAL ? 0x20 : 0x21)
#define MPWEAPON_XRAYSCANNER (VERSION == VERSION_JPN_FINAL ? 0x21 : 0x22)
#define MPWEAPON_CLOAKINGDEVICE (VERSION == VERSION_JPN_FINAL ? 0x22 : 0x23)
#define MPWEAPON_COMBATBOOST (VERSION == VERSION_JPN_FINAL ? 0x23 : 0x24)
#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
#else // add all classic weapons to multiplayer and allow combat knife in JPN
#define MPWEAPON_COMBATKNIFE 0x19
#define MPWEAPON_CROSSBOW 0x1a
#define MPWEAPON_TRANQUILIZER 0x1b
#define MPWEAPON_GRENADE 0x1c
#define MPWEAPON_NBOMB 0x1d
#define MPWEAPON_TIMEDMINE 0x1e
#define MPWEAPON_PROXIMITYMINE 0x1f
#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
Expand Down

0 comments on commit 804674e

Please sign in to comment.