Merge pull request #426 from throwaway29292/dualwieldallguns

Add a cheat to allow dual-wielding all weapons
This commit is contained in:
fgsfds authored and GitHub committed 2024-05-14 10:35:57 +02:00
commit 28d6c5b827
4 files changed
+31 -1

No files matched your search

+13
View File
@@ -100,6 +100,9 @@ struct cheat g_Cheats[] = {
{ L_MPWEAPONS_114, WEAPON_DMC, 0, 0, CHEATFLAG_FIRINGRANGE }, // DMC
{ L_MPWEAPONS_115, WEAPON_AR53, 0, 0, CHEATFLAG_FIRINGRANGE }, // AR53
{ L_MPWEAPONS_116, WEAPON_RCP45, 0, 0, CHEATFLAG_FIRINGRANGE }, // RC-P45
#ifndef PLATFORM_N64
{ L_MPWEAPONS_215, 0, SOLOSTAGEINDEX_EXTRACTION, DIFF_A, CHEATFLAG_COMPLETION }, // dual wield all guns cheat
#endif
};
u32 cheatIsUnlocked(s32 cheat_id)
@@ -1090,6 +1093,16 @@ struct menuitem g_CheatsGameplayMenuItems[] = {
0,
cheatCheckboxMenuHandler,
},
#ifndef PLATFORM_N64
{
MENUITEMTYPE_CHECKBOX,
CHEAT_DUALWIELDALLGUNS,
0,
(uintptr_t)&cheatGetNameIfUnlocked,
0,
cheatCheckboxMenuHandler,
},
#endif
{
MENUITEMTYPE_SEPARATOR,
0,
+6 -1
View File
@@ -286,7 +286,12 @@ void currentPlayerZoomIn(f32 fovpersec)
bool weaponHasFlag(s32 itemid, u32 flag)
{
struct weapon *weapon = weaponFindById(itemid);
#ifndef PLATFORM_N64 //always return, that weapon is dual-wieldable if player sets the cheat.
if (cheatIsActive(CHEAT_DUALWIELDALLGUNS) && (flag == WEAPONFLAG_DUALWIELD))
{
return true;
}
#endif
if (!weapon) {
return false;
}
+11
View File
@@ -510,6 +510,17 @@ s32 invGiveWeaponsByProp(struct prop *prop)
weapon = prop->weapon;
weaponnum = weapon->weaponnum;
otherweaponnum;
#ifndef PLATFORM_N64
//This piece of code makes the cheat work in singleplayer.
if (cheatIsActive(CHEAT_DUALWIELDALLGUNS) && !g_Vars.normmplayerisrunning)
{
if(invHasSingleWeaponExcAllGuns(weaponnum) && (invHasDoubleWeaponExcAllGuns(weapon->weaponnum, weapon->weaponnum)==0))
{
invGiveDoubleWeapon(weaponnum, weaponnum);
numgiven = 2;
}
}
#endif
if (cheatIsActive(CHEAT_PERFECTDARKNESS) && weaponnum == WEAPON_NIGHTVISION) {
return 1;
+1
View File
@@ -449,6 +449,7 @@
#define CHEAT_DMC 39
#define CHEAT_AR53 40
#define CHEAT_RCP45 41
#define CHEAT_DUALWIELDALLGUNS 42
#define CHEATFLAG_TIMED 0
#define CHEATFLAG_ALWAYSON 1