1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 12:20:00 +00:00

Switching pad modes and cheats when player is switching between controller and kb&m

This commit is contained in:
Sergeanur 2020-05-02 19:00:47 +03:00
parent d51bf48dcd
commit ba8aa38654
4 changed files with 127 additions and 32 deletions

View file

@ -528,9 +528,14 @@ void CGarage::Update()
CGarages::GivePlayerDetonator(); CGarages::GivePlayerDetonator();
CStats::KgsOfExplosivesUsed += KGS_OF_EXPLOSIVES_IN_BOMB; CStats::KgsOfExplosivesUsed += KGS_OF_EXPLOSIVES_IN_BOMB;
} }
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = CPad::IsAffectedByController ? CPad::GetPad(0)->Mode : 0;
#else
int16 Mode = CPad::GetPad(0)->Mode;
#endif
switch (m_eGarageType) { switch (m_eGarageType) {
case GARAGE_BOMBSHOP1: case GARAGE_BOMBSHOP1:
switch (CPad::GetPad(0)->Mode) { switch (Mode) {
case 0: case 0:
case 1: case 1:
case 2: case 2:
@ -542,7 +547,7 @@ void CGarage::Update()
} }
break; break;
case GARAGE_BOMBSHOP2: case GARAGE_BOMBSHOP2:
switch (CPad::GetPad(0)->Mode) { switch (Mode) {
case 0: case 0:
case 1: case 1:
case 2: case 2:

View file

@ -55,6 +55,10 @@ CMouseControllerState CPad::OldMouseControllerState;
CMouseControllerState CPad::NewMouseControllerState; CMouseControllerState CPad::NewMouseControllerState;
CMouseControllerState CPad::PCTempMouseControllerState; CMouseControllerState CPad::PCTempMouseControllerState;
#ifdef DETECT_PAD_INPUT_SWITCH
bool CPad::IsAffectedByController = false;
#endif
_TODO("gbFastTime"); _TODO("gbFastTime");
extern bool gbFastTime; extern bool gbFastTime;
@ -325,6 +329,16 @@ void AltDodoCheat(void)
} }
#endif #endif
#ifdef DETECT_PAD_INPUT_SWITCH
bool
CControllerState::IsAnyButtonPressed(void)
{
return !!LeftStickX || !!LeftStickY || !!RightStickX || !!RightStickY || !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2 ||
!!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight || !!Start || !!Select || !!Square || !!Triangle || !!Cross || !!Circle || !!LeftShock ||
!!RightShock || !!NetworkTalk;
}
#endif
void void
CControllerState::Clear(void) CControllerState::Clear(void)
{ {
@ -1037,12 +1051,21 @@ void CPad::UpdatePads(void)
#else #else
CapturePad(0); CapturePad(0);
#endif #endif
#ifdef DETECT_PAD_INPUT_SWITCH
if (GetPad(0)->PCTempJoyState.IsAnyButtonPressed())
IsAffectedByController = true;
else {
#endif
ControlsManager.ClearSimButtonPressCheckers(); ControlsManager.ClearSimButtonPressCheckers();
ControlsManager.AffectPadFromKeyBoard(); ControlsManager.AffectPadFromKeyBoard();
ControlsManager.AffectPadFromMouse(); ControlsManager.AffectPadFromMouse();
#ifdef DETECT_PAD_INPUT_SWITCH
}
if (IsAffectedByController && (GetPad(0)->PCTempKeyState.IsAnyButtonPressed() || GetPad(0)->PCTempMouseState.IsAnyButtonPressed()))
IsAffectedByController = false;
#endif
if ( CReplay::IsPlayingBackFromFile() ) if ( CReplay::IsPlayingBackFromFile() )
bUpdate = false; bUpdate = false;
@ -1096,6 +1119,9 @@ void CPad::Update(int16 unk)
void CPad::DoCheats(void) void CPad::DoCheats(void)
{ {
#ifdef DETECT_PAD_INPUT_SWITCH
if (IsAffectedByController)
#endif
GetPad(0)->DoCheats(0); GetPad(0)->DoCheats(0);
} }
@ -1159,7 +1185,9 @@ int16 CPad::GetSteeringLeftRight(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1192,7 +1220,9 @@ int16 CPad::GetSteeringUpDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1225,7 +1255,9 @@ int16 CPad::GetCarGunUpDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1252,7 +1284,9 @@ int16 CPad::GetCarGunLeftRight(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1279,7 +1313,9 @@ int16 CPad::GetPedWalkLeftRight(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1313,7 +1349,9 @@ int16 CPad::GetPedWalkUpDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1344,6 +1382,9 @@ int16 CPad::GetPedWalkUpDown(void)
int16 CPad::GetAnalogueUpDown(void) int16 CPad::GetAnalogueUpDown(void)
{ {
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1409,7 +1450,9 @@ bool CPad::GetHorn(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1448,7 +1491,9 @@ bool CPad::HornJustDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1488,7 +1533,9 @@ bool CPad::GetCarGunFired(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1515,7 +1562,9 @@ bool CPad::CarGunJustDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1542,7 +1591,9 @@ int16 CPad::GetHandBrake(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1575,7 +1626,9 @@ int16 CPad::GetBrake(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1613,7 +1666,9 @@ bool CPad::GetExitVehicle(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1640,7 +1695,9 @@ bool CPad::ExitVehicleJustDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1667,7 +1724,9 @@ int32 CPad::GetWeapon(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1700,7 +1759,9 @@ bool CPad::WeaponJustDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1733,7 +1794,9 @@ int16 CPad::GetAccelerate(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return 0; return 0;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1769,6 +1832,9 @@ int16 CPad::GetAccelerate(void)
bool CPad::CycleCameraModeUpJustDown(void) bool CPad::CycleCameraModeUpJustDown(void)
{ {
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1793,6 +1859,9 @@ bool CPad::CycleCameraModeUpJustDown(void)
bool CPad::CycleCameraModeDownJustDown(void) bool CPad::CycleCameraModeDownJustDown(void)
{ {
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1819,7 +1888,9 @@ bool CPad::ChangeStationJustDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1875,7 +1946,9 @@ bool CPad::GetTarget(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1902,7 +1975,9 @@ bool CPad::TargetJustDown(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -1937,7 +2012,9 @@ bool CPad::GetSprint(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -2092,7 +2169,9 @@ bool CPad::ForceCameraBehindPlayer(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -2125,7 +2204,9 @@ bool CPad::SniperZoomIn(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:
@ -2152,7 +2233,9 @@ bool CPad::SniperZoomOut(void)
{ {
if ( ArePlayerControlsDisabled() ) if ( ArePlayerControlsDisabled() )
return false; return false;
#ifdef DETECT_PAD_INPUT_SWITCH
int16 Mode = IsAffectedByController ? this->Mode : 0;
#endif
switch ( Mode ) switch ( Mode )
{ {
case 0: case 0:

View file

@ -29,6 +29,9 @@ public:
float GetRightStickX(void) { return RightStickX/32767.0f; }; float GetRightStickX(void) { return RightStickX/32767.0f; };
float GetRightStickY(void) { return RightStickY/32767.0f; }; float GetRightStickY(void) { return RightStickY/32767.0f; };
#ifdef DETECT_PAD_INPUT_SWITCH
bool IsAnyButtonPressed();
#endif
void Clear(void); void Clear(void);
}; };
VALIDATE_SIZE(CControllerState, 0x2A); VALIDATE_SIZE(CControllerState, 0x2A);
@ -159,6 +162,9 @@ public:
int32 AverageWeapon; int32 AverageWeapon;
int32 AverageEntries; int32 AverageEntries;
#ifdef DETECT_PAD_INPUT_SWITCH
static bool IsAffectedByController;
#endif
CPad() { } CPad() { }
~CPad() { } ~CPad() { }

View file

@ -204,6 +204,7 @@ enum Config {
#ifndef RW_GL3 #ifndef RW_GL3
#define XINPUT #define XINPUT
#endif #endif
#define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m
#define KANGAROO_CHEAT #define KANGAROO_CHEAT
#define ALLCARSHELI_CHEAT #define ALLCARSHELI_CHEAT
#define ALT_DODO_CHEAT #define ALT_DODO_CHEAT