2019-06-13 00:35:26 +00:00
# pragma warning( push )
# pragma warning( disable : 4005)
2020-04-26 10:25:03 +00:00
# if defined RW_D3D9 || defined RWLIBS
2019-06-13 00:35:26 +00:00
# define DIRECTINPUT_VERSION 0x0800
# include <dinput.h>
2020-04-26 10:25:03 +00:00
# endif
2019-06-13 00:35:26 +00:00
# pragma warning( pop )
2019-05-15 14:52:37 +00:00
# include "common.h"
2020-04-26 10:25:03 +00:00
# include "crossplatform.h"
2020-07-24 17:43:51 +00:00
# include "platform.h"
2020-03-27 18:54:35 +00:00
# ifdef XINPUT
2021-01-14 21:06:27 +00:00
# if defined _MSC_VER && !defined RE3_NO_AUTOLINK
2020-04-19 16:34:08 +00:00
# include <xinput.h>
2020-08-19 00:31:42 +00:00
# if !defined(PSAPI_VERSION) || (PSAPI_VERSION > 1)
2020-03-28 02:53:42 +00:00
# pragma comment( lib, "Xinput9_1_0.lib" )
2020-08-19 00:31:42 +00:00
# else
# pragma comment( lib, "Xinput.lib" )
# endif
2020-03-27 18:54:35 +00:00
# endif
2021-01-14 21:06:27 +00:00
# endif
2020-04-17 13:31:11 +00:00
2019-05-15 14:52:37 +00:00
# include "Pad.h"
2019-06-13 00:35:26 +00:00
# include "ControllerConfig.h"
# include "Timer.h"
# include "Frontend.h"
# include "Camera.h"
# include "Game.h"
# include "CutsceneMgr.h"
# include "Font.h"
2019-07-01 19:46:44 +00:00
# include "Hud.h"
2019-06-13 00:35:26 +00:00
# include "Text.h"
# include "Timer.h"
2020-04-10 08:03:38 +00:00
# include "Record.h"
2019-06-13 00:35:26 +00:00
# include "World.h"
# include "Vehicle.h"
# include "Ped.h"
# include "Population.h"
2020-04-10 23:03:42 +00:00
# include "Record.h"
2019-06-13 00:35:26 +00:00
# include "Replay.h"
# include "Weather.h"
2020-04-08 21:16:29 +00:00
# include "Streaming.h"
# include "PathFind.h"
# include "Wanted.h"
2020-05-27 21:15:37 +00:00
# include "WaterLevel.h"
2020-04-08 21:16:29 +00:00
# include "General.h"
2020-06-10 20:47:48 +00:00
# include "Fluff.h"
2020-06-14 12:57:27 +00:00
# include "Gangs.h"
2020-07-21 02:59:31 +00:00
# include "platform.h"
2020-08-13 20:39:55 +00:00
# include "Stats.h"
2020-08-16 15:39:11 +00:00
# include "CarCtrl.h"
2020-08-30 20:47:12 +00:00
# include "TrafficLights.h"
2019-05-15 14:52:37 +00:00
2020-06-27 21:01:51 +00:00
# ifdef GTA_PS2
# include "eetypes.h"
# include "libpad.h"
# endif
2020-10-07 21:21:44 +00:00
// --MIAMI: file done except Mobile(see TODOs) and PS2 stuff
2020-04-17 05:54:14 +00:00
CPad Pads [ MAX_PADS ] ;
2020-06-27 21:01:51 +00:00
# ifdef GTA_PS2
u_long128 pad_dma_buf [ scePadDmaBufferMax ] __attribute__ ( ( aligned ( 64 ) ) ) ;
u_long128 pad2_dma_buf [ scePadDmaBufferMax ] __attribute__ ( ( aligned ( 64 ) ) ) ;
# endif
2020-04-17 05:54:14 +00:00
CMousePointerStateHelper MousePointerStateHelper ;
2019-06-02 03:00:38 +00:00
2020-04-17 05:54:14 +00:00
bool CPad : : bDisplayNoControllerMessage ;
bool CPad : : bObsoleteControllerMessage ;
2020-04-08 23:52:38 +00:00
bool CPad : : bOldDisplayNoControllerMessage ;
2020-04-17 05:54:14 +00:00
bool CPad : : m_bMapPadOneToPadTwo ;
2020-10-07 21:21:44 +00:00
bool CPad : : m_bDebugCamPCOn ;
2020-08-13 20:39:55 +00:00
bool CPad : : bHasPlayerCheated ;
2020-10-07 21:21:44 +00:00
bool CPad : : bInvertLook4Pad ;
2020-06-27 21:01:51 +00:00
# ifdef GTA_PS2
unsigned char act_direct [ 6 ] ;
unsigned char act_align [ 6 ] ;
# endif
2019-06-13 00:35:26 +00:00
2020-04-17 05:54:14 +00:00
CKeyboardState CPad : : OldKeyState ;
CKeyboardState CPad : : NewKeyState ;
CKeyboardState CPad : : TempKeyState ;
2019-05-15 14:52:37 +00:00
2020-05-21 14:28:03 +00:00
char CPad : : KeyBoardCheatString [ 30 ] ;
2019-06-13 00:35:26 +00:00
2020-04-17 05:54:14 +00:00
CMouseControllerState CPad : : OldMouseControllerState ;
CMouseControllerState CPad : : NewMouseControllerState ;
CMouseControllerState CPad : : PCTempMouseControllerState ;
2019-05-15 14:52:37 +00:00
2020-05-02 16:00:47 +00:00
# ifdef DETECT_PAD_INPUT_SWITCH
bool CPad : : IsAffectedByController = false ;
# endif
2019-06-13 00:35:26 +00:00
_TODO ( " gbFastTime " ) ;
2020-04-17 05:54:14 +00:00
extern bool gbFastTime ;
2019-05-31 17:02:26 +00:00
2020-09-11 15:46:16 +00:00
# ifdef WALLCLIMB_CHEAT
extern bool gGravityCheat ;
# endif
2020-10-07 21:21:44 +00:00
void SpecialCarCheats ( )
{
if ( ! CVehicle : : bCheat9 )
{
( ( CVehicleModelInfo * ) CModelInfo : : GetModelInfo ( MI_INFERNUS ) ) - > m_wheelScale * = 1.3f ;
( ( CVehicleModelInfo * ) CModelInfo : : GetModelInfo ( MI_CHEETAH ) ) - > m_wheelScale * = 1.3f ;
( ( CVehicleModelInfo * ) CModelInfo : : GetModelInfo ( MI_PHEONIX ) ) - > m_wheelScale * = 1.3f ;
( ( CVehicleModelInfo * ) CModelInfo : : GetModelInfo ( MI_DELUXO ) ) - > m_wheelScale * = 1.3f ;
mod_HandlingManager . GetHandlingData ( HANDLING_LANDSTAL ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_PATRIOT ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_BOBCAT ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_BFINJECT ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_RANCHER ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_DESPERAD ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_DELUXO ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_BAGGAGE ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_BAGGAGE ) - > Transmission . fMaxVelocity * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_BAGGAGE ) - > Transmission . InitGearRatios ( ) ;
mod_HandlingManager . GetHandlingData ( HANDLING_GOLFCART ) - > Transmission . fEngineAcceleration * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_GOLFCART ) - > Transmission . fMaxVelocity * = 2.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_GOLFCART ) - > Transmission . InitGearRatios ( ) ;
mod_HandlingManager . GetHandlingData ( HANDLING_STINGER ) - > fCollisionDamageMultiplier * = 0.25f ;
mod_HandlingManager . GetHandlingData ( HANDLING_STINGER ) - > fMass * = 2.5f ;
mod_HandlingManager . GetHandlingData ( HANDLING_STINGER ) - > fTurnMass * = 4.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_BANSHEE ) - > fCollisionDamageMultiplier * = 0.25f ;
mod_HandlingManager . GetHandlingData ( HANDLING_BANSHEE ) - > fMass * = 2.5f ;
mod_HandlingManager . GetHandlingData ( HANDLING_BANSHEE ) - > fTurnMass * = 4.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_SABRETUR ) - > fCollisionDamageMultiplier * = 0.25f ;
mod_HandlingManager . GetHandlingData ( HANDLING_SABRETUR ) - > fMass * = 2.5f ;
mod_HandlingManager . GetHandlingData ( HANDLING_SABRETUR ) - > fTurnMass * = 4.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_COMET ) - > fCollisionDamageMultiplier * = 0.25f ;
mod_HandlingManager . GetHandlingData ( HANDLING_COMET ) - > fMass * = 2.5f ;
mod_HandlingManager . GetHandlingData ( HANDLING_COMET ) - > fTurnMass * = 4.0f ;
mod_HandlingManager . GetHandlingData ( HANDLING_DELUXO ) - > fCollisionDamageMultiplier * = 0.25f ;
mod_HandlingManager . GetHandlingData ( HANDLING_DELUXO ) - > fMass * = 2.5f ;
mod_HandlingManager . GetHandlingData ( HANDLING_DELUXO ) - > fTurnMass * = 4.0f ;
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CVehicle : : bCheat9 = true ;
CPad : : bHasPlayerCheated = true ;
}
}
void PickUpChicksCheat ( )
{
if ( FindPlayerVehicle ( ) & & ( FindPlayerVehicle ( ) - > IsCar ( ) | | FindPlayerVehicle ( ) - > IsBike ( ) ) )
{
CVehicle * vehicle = FindPlayerVehicle ( ) ;
if ( FindPlayerVehicle ( ) - > m_vehType = = 5 )
{
if ( vehicle - > pPassengers [ 0 ] )
vehicle - > pPassengers [ 0 ] - > SetObjective ( OBJECTIVE_LEAVE_CAR , vehicle ) ;
}
CPed * someoneElse = ( CPed * ) CWorld : : TestSphereAgainstWorld ( vehicle - > GetPosition ( ) , 6.0f , FindPlayerPed ( ) , false , false , true , false , false , false ) ;
if ( someoneElse & & someoneElse - > m_nPedState ! = PED_DRIVING )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
someoneElse - > SetObjective ( OBJECTIVE_ENTER_CAR_AS_PASSENGER , vehicle ) ;
}
}
}
2020-06-03 21:48:26 +00:00
void WeaponCheat1 ( )
2020-04-08 21:16:29 +00:00
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT2 " ) , true ) ;
2020-05-15 14:30:25 +00:00
2020-06-03 21:48:26 +00:00
CStreaming : : RequestModel ( MI_BRASS_KNUCKLES , STREAMFLAGS_DONT_REMOVE ) ;
2020-05-15 14:30:25 +00:00
CStreaming : : RequestModel ( MI_BASEBALL_BAT , STREAMFLAGS_DONT_REMOVE ) ;
2020-06-03 21:48:26 +00:00
CStreaming : : RequestModel ( MI_MOLOTOV , STREAMFLAGS_DONT_REMOVE ) ;
2020-05-23 13:53:20 +00:00
CStreaming : : RequestModel ( MI_COLT45 , STREAMFLAGS_DONT_REMOVE ) ;
2020-06-03 21:48:26 +00:00
CStreaming : : RequestModel ( MI_SHOTGUN , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_TEC9 , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_RUGER , STREAMFLAGS_DONT_REMOVE ) ;
2020-05-23 13:53:20 +00:00
CStreaming : : RequestModel ( MI_SNIPERRIFLE , STREAMFLAGS_DONT_REMOVE ) ;
2020-06-03 21:48:26 +00:00
CStreaming : : RequestModel ( MI_FLAMETHROWER , STREAMFLAGS_DONT_REMOVE ) ;
2020-05-15 14:30:25 +00:00
CStreaming : : LoadAllRequestedModels ( false ) ;
2020-06-03 21:48:26 +00:00
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_BRASSKNUCKLE , 1 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_BASEBALLBAT , 1 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_MOLOTOV , 10 ) ;
2020-04-08 21:16:29 +00:00
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_COLT45 , 100 ) ;
2020-06-03 21:48:26 +00:00
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_SHOTGUN , 50 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_TEC9 , 150 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_RUGER , 120 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_SNIPERRIFLE , 25 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_FLAMETHROWER , 200 ) ;
CStreaming : : SetModelIsDeletable ( MI_BRASS_KNUCKLES ) ;
CStreaming : : SetModelIsDeletable ( MI_BASEBALL_BAT ) ;
CStreaming : : SetModelIsDeletable ( MI_MOLOTOV ) ;
CStreaming : : SetModelIsDeletable ( MI_COLT45 ) ;
CStreaming : : SetModelIsDeletable ( MI_SHOTGUN ) ;
CStreaming : : SetModelIsDeletable ( MI_TEC9 ) ;
CStreaming : : SetModelIsDeletable ( MI_RUGER ) ;
CStreaming : : SetModelIsDeletable ( MI_SNIPERRIFLE ) ;
CStreaming : : SetModelIsDeletable ( MI_FLAMETHROWER ) ;
2020-10-07 21:21:44 +00:00
# ifdef MOBILE_IMPROVEMENTS
if ( FindPlayerVehicle ( ) ) {
FindPlayerPed ( ) - > RemoveWeaponWhenEnteringVehicle ( ) ;
}
# endif
2020-06-03 21:48:26 +00:00
}
void WeaponCheat2 ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT2 " ) , true ) ;
CStreaming : : RequestModel ( MI_KATANA , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_GRENADE , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_BOMB , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_PYTHON , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_STUBBY_SHOTGUN , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_SILENCEDINGRAM , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_M4 , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_LASERSCOPE , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_ROCKETLAUNCHER , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : LoadAllRequestedModels ( false ) ;
2020-11-13 10:19:54 +00:00
# ifdef FIX_BUGS
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_KATANA , 1 ) ;
# else
2020-06-03 21:48:26 +00:00
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_KATANA , 0 ) ;
2020-11-13 10:19:54 +00:00
# endif
2020-06-03 21:48:26 +00:00
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_DETONATOR_GRENADE , 10 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_PYTHON , 40 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_STUBBY_SHOTGUN , 25 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_SILENCED_INGRAM , 100 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_M4 , 150 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_LASERSCOPE , 21 ) ;
2020-04-08 21:16:29 +00:00
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_ROCKETLAUNCHER , 5 ) ;
2020-05-15 14:30:25 +00:00
2020-06-03 21:48:26 +00:00
CStreaming : : SetModelIsDeletable ( MI_KATANA ) ;
2020-05-15 14:30:25 +00:00
CStreaming : : SetModelIsDeletable ( MI_GRENADE ) ;
CStreaming : : SetModelIsDeletable ( MI_BOMB ) ;
2020-06-03 21:48:26 +00:00
CStreaming : : SetModelIsDeletable ( MI_PYTHON ) ;
CStreaming : : SetModelIsDeletable ( MI_STUBBY_SHOTGUN ) ;
CStreaming : : SetModelIsDeletable ( MI_SILENCEDINGRAM ) ;
CStreaming : : SetModelIsDeletable ( MI_M4 ) ;
CStreaming : : SetModelIsDeletable ( MI_LASERSCOPE ) ;
2020-05-15 14:30:25 +00:00
CStreaming : : SetModelIsDeletable ( MI_ROCKETLAUNCHER ) ;
2020-10-07 21:21:44 +00:00
# ifdef MOBILE_IMPROVEMENTS
if ( FindPlayerVehicle ( ) ) {
FindPlayerPed ( ) - > RemoveWeaponWhenEnteringVehicle ( ) ;
}
# endif
2020-06-03 21:48:26 +00:00
}
void WeaponCheat3 ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT2 " ) , true ) ;
CStreaming : : RequestModel ( MI_CHAINSAW , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_GRENADE , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_PYTHON , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_SPAS12_SHOTGUN , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_MP5 , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_M4 , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_LASERSCOPE , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_MINIGUN , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : RequestModel ( MI_MINIGUN2 , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : LoadAllRequestedModels ( false ) ;
2020-11-13 10:19:54 +00:00
# ifdef FIX_BUGS
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_CHAINSAW , 1 ) ;
# else
2020-06-03 21:48:26 +00:00
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_CHAINSAW , 0 ) ;
2020-11-13 10:19:54 +00:00
# endif
2020-06-03 21:48:26 +00:00
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_GRENADE , 10 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_PYTHON , 40 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_SPAS12_SHOTGUN , 30 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_MP5 , 100 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_M4 , 150 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_LASERSCOPE , 21 ) ;
FindPlayerPed ( ) - > GiveWeapon ( WEAPONTYPE_MINIGUN , 500 ) ;
CStreaming : : SetModelIsDeletable ( MI_CHAINSAW ) ;
CStreaming : : SetModelIsDeletable ( MI_GRENADE ) ;
CStreaming : : SetModelIsDeletable ( MI_PYTHON ) ;
2020-05-23 13:53:20 +00:00
CStreaming : : SetModelIsDeletable ( MI_SPAS12_SHOTGUN ) ;
2020-05-15 14:30:25 +00:00
CStreaming : : SetModelIsDeletable ( MI_MP5 ) ;
2020-06-03 21:48:26 +00:00
CStreaming : : SetModelIsDeletable ( MI_M4 ) ;
CStreaming : : SetModelIsDeletable ( MI_LASERSCOPE ) ;
CStreaming : : SetModelIsDeletable ( MI_MINIGUN ) ;
CStreaming : : SetModelIsDeletable ( MI_MINIGUN2 ) ;
2020-10-07 21:21:44 +00:00
# ifdef MOBILE_IMPROVEMENTS
if ( FindPlayerVehicle ( ) ) {
FindPlayerPed ( ) - > RemoveWeaponWhenEnteringVehicle ( ) ;
}
# endif
2020-04-08 21:16:29 +00:00
}
void HealthCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT3 " ) , true ) ;
2020-05-16 20:06:33 +00:00
FindPlayerPed ( ) - > m_fHealth = CWorld : : Players [ 0 ] . m_nMaxHealth ;
2020-04-08 21:16:29 +00:00
if ( FindPlayerVehicle ( ) ) {
FindPlayerVehicle ( ) - > m_fHealth = 1000.0f ;
2020-06-14 12:57:27 +00:00
if ( FindPlayerVehicle ( ) - > m_vehType = = VEHICLE_TYPE_CAR ) {
2020-04-08 21:16:29 +00:00
( ( CAutomobile * ) FindPlayerVehicle ( ) ) - > Damage . SetEngineStatus ( 0 ) ;
2020-06-14 12:57:27 +00:00
for ( int32 i = 0 ; i < 4 ; i + + )
( ( CAutomobile * ) FindPlayerVehicle ( ) ) - > Damage . SetWheelStatus ( i , WHEEL_STATUS_OK ) ;
}
2020-04-08 21:16:29 +00:00
}
}
2020-10-07 21:21:44 +00:00
// TODO(Miami): this is HELLA different on mobile, although it mostly has debug oriented things like player exiting it's current car and enters spawned one etc.
2020-08-30 20:47:12 +00:00
void VehicleCheat ( int model )
2020-04-08 21:16:29 +00:00
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
2020-08-30 20:47:12 +00:00
CStreaming : : RequestModel ( model , STREAMFLAGS_DONT_REMOVE ) ;
CStreaming : : LoadAllRequestedModels ( false ) ;
2020-05-21 14:28:03 +00:00
if ( CStreaming : : ms_aInfoForModel [ model ] . m_loadState = = STREAMSTATE_LOADED ) {
2020-04-08 21:16:29 +00:00
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
2020-08-30 20:47:12 +00:00
if ( ! ( CStreaming : : ms_aInfoForModel [ model ] . m_loadState & STREAMFLAGS_DONT_REMOVE ) ) {
CStreaming : : SetModelIsDeletable ( model ) ;
CStreaming : : SetModelTxdIsDeletable ( model ) ;
}
int32 node = ThePaths . FindNodeClosestToCoors ( FindPlayerCoors ( ) , PATH_CAR , 100.0f ) ;
2020-04-08 21:16:29 +00:00
if ( node < 0 ) return ;
2020-05-21 14:28:03 +00:00
2020-04-08 21:16:29 +00:00
# ifdef FIX_BUGS
2020-05-21 14:28:03 +00:00
CAutomobile * vehicle = new CAutomobile ( model , RANDOM_VEHICLE ) ;
2020-04-08 21:16:29 +00:00
# else
2020-10-07 21:21:44 +00:00
CAutomobile * vehicle = new CAutomobile ( model , MISSION_VEHICLE ) ;
2020-04-08 21:16:29 +00:00
# endif
2020-05-21 14:28:03 +00:00
if ( vehicle ! = nil ) {
2020-05-03 13:57:57 +00:00
CVector pos = ThePaths . m_pathNodes [ node ] . GetPosition ( ) ;
2020-04-08 21:16:29 +00:00
pos . z + = 4.0f ;
2020-05-21 14:28:03 +00:00
vehicle - > SetPosition ( pos ) ;
vehicle - > SetOrientation ( 0.0f , 0.0f , DEGTORAD ( 200.0f ) ) ;
2020-04-08 21:16:29 +00:00
2020-05-21 14:28:03 +00:00
vehicle - > SetStatus ( STATUS_ABANDONED ) ;
vehicle - > m_nDoorLock = CARLOCK_UNLOCKED ;
CWorld : : Add ( vehicle ) ;
2020-04-08 21:16:29 +00:00
}
}
2020-08-13 20:39:55 +00:00
CStats : : CheatedCount + = 1000 ;
CPad : : bHasPlayerCheated = true ;
2020-04-08 21:16:29 +00:00
}
2020-10-07 21:21:44 +00:00
2020-04-08 21:16:29 +00:00
void BlowUpCarsCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
int i = CPools : : GetVehiclePool ( ) - > GetSize ( ) ;
while ( i - - > 0 ) {
if ( CVehicle * veh = CPools : : GetVehiclePool ( ) - > GetSlot ( i ) )
veh - > BlowUpCar ( nil ) ;
}
}
void ChangePlayerCheat ( )
{
2020-10-07 21:21:44 +00:00
// I don't know wtf is going on in here...
int modelId , anotherModelId ;
2020-04-08 21:16:29 +00:00
if ( FindPlayerPed ( ) - > IsPedInControl ( ) & & CModelInfo : : GetModelInfo ( " player " , nil ) ) {
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CPlayerPed * ped = FindPlayerPed ( ) ;
AssocGroupId AnimGrp = ped - > m_animGroup ;
do
{
2020-10-07 21:21:44 +00:00
do {
modelId = CGeneral : : GetRandomNumberInRange ( 0 , MI_PGA ) ;
anotherModelId = modelId + 1 ;
} while ( ! CModelInfo : : GetModelInfo ( anotherModelId ) ) ;
} while ( anotherModelId > = MI_SPECIAL01 & & anotherModelId < = MI_SPECIAL04 | | modelId = = MI_TAXI_D ) ;
2020-04-08 21:16:29 +00:00
2020-10-07 21:21:44 +00:00
uint8 flags = CStreaming : : ms_aInfoForModel [ anotherModelId ] . m_flags ;
2020-04-08 21:16:29 +00:00
ped - > DeleteRwObject ( ) ;
2020-10-07 21:21:44 +00:00
CStreaming : : RequestModel ( anotherModelId , STREAMFLAGS_DEPENDENCY | STREAMFLAGS_DONT_REMOVE ) ;
2020-04-08 21:16:29 +00:00
CStreaming : : LoadAllRequestedModels ( false ) ;
ped - > m_modelIndex = - 1 ;
2020-10-07 21:21:44 +00:00
ped - > SetModelIndex ( anotherModelId ) ;
2020-04-08 21:16:29 +00:00
ped - > m_animGroup = AnimGrp ;
2020-10-07 21:21:44 +00:00
if ( modelId ! = - 1 ) {
2020-04-08 21:16:29 +00:00
if ( ! ( flags & STREAMFLAGS_DONT_REMOVE ) )
2020-10-07 21:21:44 +00:00
CStreaming : : SetModelIsDeletable ( anotherModelId ) ;
2020-04-08 21:16:29 +00:00
}
}
}
2020-06-10 20:19:05 +00:00
void ChangePlayerModel ( const char * name ) {
if ( ! FindPlayerVehicle ( ) ) {
FindPlayerPed ( ) - > Undress ( name ) ;
CStreaming : : LoadAllRequestedModels ( 0 ) ;
FindPlayerPed ( ) - > Dress ( ) ;
}
}
2020-04-08 21:16:29 +00:00
void MayhemCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
for ( int i = PEDTYPE_CIVMALE ; i < PEDTYPE_SPECIAL ; i + + )
CPedType : : SetThreats ( i , PED_FLAG_PLAYER1 | PED_FLAG_PLAYER2 | PED_FLAG_PLAYER3 | PED_FLAG_PLAYER4 |
PED_FLAG_CIVMALE | PED_FLAG_CIVFEMALE | PED_FLAG_COP | PED_FLAG_GANG1 |
PED_FLAG_GANG2 | PED_FLAG_GANG3 | PED_FLAG_GANG4 | PED_FLAG_GANG5 |
PED_FLAG_GANG6 | PED_FLAG_GANG7 | PED_FLAG_GANG8 | PED_FLAG_GANG9 |
PED_FLAG_EMERGENCY | PED_FLAG_PROSTITUTE | PED_FLAG_CRIMINAL | PED_FLAG_SPECIAL ) ;
2020-08-13 20:39:55 +00:00
CStats : : CheatedCount + = 1000 ;
CPad : : bHasPlayerCheated = true ;
2020-04-08 21:16:29 +00:00
}
void EverybodyAttacksPlayerCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
for ( int i = PEDTYPE_CIVMALE ; i < PEDTYPE_SPECIAL ; i + + )
CPedType : : AddThreat ( i , PED_FLAG_PLAYER1 ) ;
2020-08-13 20:39:55 +00:00
CStats : : CheatedCount + = 1000 ;
CPad : : bHasPlayerCheated = true ;
2020-04-08 21:16:29 +00:00
}
void WeaponsForAllCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CPopulation : : ms_bGivePedsWeapons = ! CPopulation : : ms_bGivePedsWeapons ;
2020-08-13 20:39:55 +00:00
CStats : : CheatedCount + = 1000 ;
CPad : : bHasPlayerCheated = true ;
2020-04-08 21:16:29 +00:00
}
void FastTimeCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
if ( CTimer : : GetTimeScale ( ) < 4.0f )
CTimer : : SetTimeScale ( CTimer : : GetTimeScale ( ) * 2.0f ) ;
}
void SlowTimeCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
if ( CTimer : : GetTimeScale ( ) > 0.25f )
CTimer : : SetTimeScale ( CTimer : : GetTimeScale ( ) * 0.5f ) ;
}
void MoneyCheat ( )
{
CWorld : : Players [ CWorld : : PlayerInFocus ] . m_nMoney + = 250000 ;
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT6 " ) , true ) ;
}
void ArmourCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT4 " ) , true ) ;
2020-05-16 20:06:33 +00:00
FindPlayerPed ( ) - > m_fArmour = CWorld : : Players [ 0 ] . m_nMaxArmour ;
2020-04-08 21:16:29 +00:00
}
void WantedLevelUpCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT5 " ) , true ) ;
2020-06-22 01:02:44 +00:00
FindPlayerPed ( ) - > m_pWanted - > CheatWantedLevel ( Min ( FindPlayerPed ( ) - > m_pWanted - > m_nWantedLevel + 2 , 6 ) ) ;
2020-04-08 21:16:29 +00:00
}
void WantedLevelDownCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT5 " ) , true ) ;
2020-06-22 01:02:44 +00:00
FindPlayerPed ( ) - > m_pWanted - > CheatWantedLevel ( 0 ) ;
2020-04-08 21:16:29 +00:00
}
void SunnyWeatherCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT7 " ) , true ) ;
CWeather : : ForceWeatherNow ( WEATHER_SUNNY ) ;
}
2020-08-30 20:47:12 +00:00
void ExtraSunnyWeatherCheat ( )
2020-04-08 21:16:29 +00:00
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT7 " ) , true ) ;
2020-08-30 20:47:12 +00:00
CWeather : : ForceWeatherNow ( WEATHER_EXTRA_SUNNY ) ;
2020-04-08 21:16:29 +00:00
}
2020-08-30 20:47:12 +00:00
void CloudyWeatherCheat ( )
2020-06-05 01:19:53 +00:00
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT7 " ) , true ) ;
2020-08-30 20:47:12 +00:00
CWeather : : ForceWeatherNow ( WEATHER_CLOUDY ) ;
2020-06-05 01:19:53 +00:00
}
2020-04-08 21:16:29 +00:00
void RainyWeatherCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT7 " ) , true ) ;
CWeather : : ForceWeatherNow ( WEATHER_RAINY ) ;
}
void FoggyWeatherCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT7 " ) , true ) ;
CWeather : : ForceWeatherNow ( WEATHER_FOGGY ) ;
}
void FastWeatherCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
gbFastTime = ! gbFastTime ;
}
void OnlyRenderWheelsCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CVehicle : : bWheelsOnlyCheat = ! CVehicle : : bWheelsOnlyCheat ;
2020-08-13 20:39:55 +00:00
CStats : : CheatedCount + = 1000 ;
CPad : : bHasPlayerCheated = true ;
2020-04-08 21:16:29 +00:00
}
void ChittyChittyBangBangCheat ( )
{
2020-10-02 23:26:49 +00:00
# ifdef BETTER_ALLCARSAREDODO_CHEAT
CHud : : SetHelpMessage ( TheText . Get ( ! CVehicle : : bAllDodosCheat ? " CHEAT1 " : " CHEATOF " ) , true ) ;
# else
2020-04-08 21:16:29 +00:00
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
2020-10-02 23:26:49 +00:00
# endif
2020-04-08 21:16:29 +00:00
CVehicle : : bAllDodosCheat = ! CVehicle : : bAllDodosCheat ;
2020-08-13 20:39:55 +00:00
CStats : : CheatedCount + = 1000 ;
CPad : : bHasPlayerCheated = true ;
2020-04-08 21:16:29 +00:00
}
void StrongGripCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CVehicle : : bCheat3 = ! CVehicle : : bCheat3 ;
2020-08-13 20:39:55 +00:00
CStats : : CheatedCount + = 1000 ;
CPad : : bHasPlayerCheated = true ;
2020-04-08 21:16:29 +00:00
}
2020-06-14 12:57:27 +00:00
void FannyMagnetCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CPed : : bFannyMagnetCheat = ! CPed : : bFannyMagnetCheat ;
2020-08-13 20:39:55 +00:00
CPad : : bHasPlayerCheated = true ;
2020-06-14 12:57:27 +00:00
}
2020-05-10 15:09:14 +00:00
void BlackCarsCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
gbBlackCars = true ;
gbPinkCars = false ;
}
void PinkCarsCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
gbBlackCars = false ;
gbPinkCars = true ;
}
2020-05-27 21:15:37 +00:00
2020-08-30 20:47:12 +00:00
void TrafficLightsCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CTrafficLights : : bGreenLightsCheat = true ;
}
2020-08-16 15:39:11 +00:00
void MadCarsCheat ( )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CCarCtrl : : bMadDriversCheat = true ;
}
2020-05-27 21:15:37 +00:00
void NoSeaBedCheat ( void )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CWaterLevel : : m_bRenderSeaBed = ! CWaterLevel : : m_bRenderSeaBed ;
}
void RenderWaterLayersCheat ( void )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
if ( + + CWaterLevel : : m_nRenderWaterLayers > 5 )
CWaterLevel : : m_nRenderWaterLayers = 0 ;
}
2020-05-28 16:53:54 +00:00
void BackToTheFuture ( void )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CVehicle : : bHoverCheat = ! CVehicle : : bHoverCheat ;
2020-08-13 20:39:55 +00:00
CPad : : bHasPlayerCheated = true ;
2020-05-28 16:53:54 +00:00
}
2020-06-10 20:19:05 +00:00
void SuicideCheat ( void ) {
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
FindPlayerPed ( ) - > InflictDamage ( nil , WEAPONTYPE_UNARMED , 1000.0f , PEDPIECE_TORSO , 0 ) ;
}
2020-05-27 21:15:37 +00:00
2020-06-14 12:57:27 +00:00
void DoChicksWithGunsCheat ( void ) {
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CStreaming : : SetModelIsDeletable ( CGangs : : GetGangPedModel1 ( GANG_PLAYER ) ) ;
CStreaming : : SetModelIsDeletable ( CGangs : : GetGangPedModel2 ( GANG_PLAYER ) ) ;
CStreaming : : SetModelTxdIsDeletable ( CGangs : : GetGangPedModel1 ( GANG_PLAYER ) ) ;
CStreaming : : SetModelTxdIsDeletable ( CGangs : : GetGangPedModel2 ( GANG_PLAYER ) ) ;
CStreaming : : RemoveCurrentZonesModels ( ) ;
CGangs : : SetGangPedModels ( GANG_PLAYER , MI_HFYBE , MI_WFYBE ) ;
CGangs : : SetGangWeapons ( GANG_PLAYER , WEAPONTYPE_M4 , WEAPONTYPE_M4 ) ;
2020-08-13 20:39:55 +00:00
CStats : : CheatedCount + = 1000 ;
CPad : : bHasPlayerCheated = true ;
2020-06-14 12:57:27 +00:00
}
2019-06-13 00:35:26 +00:00
//////////////////////////////////////////////////////////////////////////
2019-05-30 19:24:47 +00:00
2019-07-01 19:46:44 +00:00
# ifdef KANGAROO_CHEAT
void KangarooCheat ( )
{
wchar * string ;
CPed * playerPed = FindPlayerPed ( ) ;
int m_fMass ;
if ( playerPed - > m_ped_flagI80 ) {
string = TheText . Get ( " CHEATOF " ) ;
m_fMass = 70.0f ;
} else {
string = TheText . Get ( " CHEAT1 " ) ;
m_fMass = 15.0f ;
}
2020-04-08 21:16:29 +00:00
CHud : : SetHelpMessage ( string , true ) ;
2019-07-01 19:46:44 +00:00
playerPed - > m_ped_flagI80 = ! playerPed - > m_ped_flagI80 ;
playerPed - > m_fMass = m_fMass ;
playerPed - > m_fAirResistance = 0.4f / m_fMass ;
}
# endif
2020-09-28 23:29:10 +00:00
# ifdef RESTORE_ALLCARSHELI_CHEAT
2020-04-25 18:25:14 +00:00
void AllCarsHeliCheat ( void )
{
wchar * string ;
if ( bAllCarCheat ) {
string = TheText . Get ( " CHEATOF " ) ;
bAllCarCheat = false ;
}
else {
string = TheText . Get ( " CHEAT1 " ) ;
bAllCarCheat = true ;
}
CHud : : SetHelpMessage ( string , true ) ;
}
# endif
2020-09-11 15:46:16 +00:00
# ifdef WALLCLIMB_CHEAT
void WallClimbingCheat ( void )
{
wchar * string ;
if ( gGravityCheat ) {
string = TheText . Get ( " CHEATOF " ) ;
gGravityCheat = false ;
}
else {
string = TheText . Get ( " CHEAT1 " ) ;
gGravityCheat = true ;
}
CHud : : SetHelpMessage ( string , true ) ;
}
# endif
2020-06-14 12:57:27 +00:00
void FlyingFishCheat ( void )
{
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CVehicle : : bCheat8 = ! CVehicle : : bCheat8 ;
2020-10-07 21:21:44 +00:00
CPad : : bHasPlayerCheated = true ;
2020-06-14 12:57:27 +00:00
}
2020-08-30 20:47:12 +00:00
void DoShowChaseStatCheat ( void ) {
CHud : : SetHelpMessage ( TheText . Get ( " CHEAT1 " ) , true ) ;
CStats : : ShowChaseStatOnScreen = 1 ;
}
2020-05-02 16:00:47 +00:00
bool
2020-05-29 19:05:33 +00:00
CControllerState : : CheckForInput ( void )
2020-05-02 16:00:47 +00:00
{
2020-06-30 04:44:51 +00:00
return ! ! RightStickX | | ! ! RightStickY | | ! ! LeftStickX | | ! ! LeftStickY
| | ! ! DPadUp | | ! ! DPadDown | | ! ! DPadLeft | | ! ! DPadRight
| | ! ! Triangle | | ! ! Cross | | ! ! Circle | | ! ! Square
| | ! ! Start | | ! ! Select
| | ! ! LeftShoulder1 | | ! ! LeftShoulder2 | | ! ! RightShoulder1 | | ! ! RightShoulder2
| | ! ! LeftShock | | ! ! RightShock ;
2020-05-02 16:00:47 +00:00
}
2019-05-15 14:52:37 +00:00
void
CControllerState : : Clear ( void )
{
2019-06-13 00:35:26 +00:00
LeftStickX = LeftStickY = RightStickX = RightStickY = 0 ;
LeftShoulder1 = LeftShoulder2 = RightShoulder1 = RightShoulder2 = 0 ;
DPadUp = DPadDown = DPadLeft = DPadRight = 0 ;
Start = Select = 0 ;
Square = Triangle = Cross = Circle = 0 ;
LeftShock = RightShock = 0 ;
2019-05-29 16:06:33 +00:00
NetworkTalk = 0 ;
}
2019-06-13 00:35:26 +00:00
void CKeyboardState : : Clear ( )
{
2020-06-27 22:57:01 +00:00
for ( int32 i = 0 ; i < ARRAY_SIZE ( F ) ; i + + )
2019-06-13 00:35:26 +00:00
F [ i ] = 0 ;
2020-06-27 21:31:45 +00:00
2020-06-27 22:57:01 +00:00
for ( int32 i = 0 ; i < ARRAY_SIZE ( VK_KEYS ) ; i + + )
2019-06-13 00:35:26 +00:00
VK_KEYS [ i ] = 0 ;
ESC = INS = DEL = HOME = END = PGUP = PGDN = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
UP = DOWN = LEFT = RIGHT = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
NUMLOCK = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
DIV = MUL = SUB = ADD = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
DECIMAL = NUM1 = NUM2 = NUM3 = NUM4 = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
NUM5 = NUM6 = NUM7 = NUM8 = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
NUM9 = NUM0 = SCROLLLOCK = PAUSE = 0 ;
BACKSP = TAB = CAPSLOCK = EXTENTER = 0 ;
LSHIFT = SHIFT = RSHIFT = LCTRL = RCTRL = LALT = RALT = 0 ;
LWIN = RWIN = APPS = 0 ;
}
2020-04-09 03:20:44 +00:00
# ifdef GTA_PS2_STUFF
2020-04-08 23:52:38 +00:00
void CPad : : Initialise ( void )
{
2020-06-27 21:01:51 +00:00
# ifdef GTA_PS2
scePadInit ( 0 ) ;
2020-06-27 21:31:45 +00:00
scePadPortOpen ( 0 , 0 , pad_dma_buf ) ;
scePadPortOpen ( 1 , 0 , pad2_dma_buf ) ;
2020-06-27 21:01:51 +00:00
# endif
2020-04-08 23:52:38 +00:00
for ( int i = 0 ; i < MAX_PADS ; i + + )
{
CPad : : GetPad ( i ) - > Clear ( true ) ;
CPad : : GetPad ( i ) - > Mode = 0 ;
}
2020-06-27 21:31:45 +00:00
bObsoleteControllerMessage = false ;
2020-04-08 23:52:38 +00:00
bOldDisplayNoControllerMessage = false ;
2020-06-27 21:31:45 +00:00
bDisplayNoControllerMessage = false ;
2020-10-07 21:21:44 +00:00
m_bMapPadOneToPadTwo = false ;
m_bDebugCamPCOn = false ;
2020-04-08 23:52:38 +00:00
}
2020-04-09 03:20:44 +00:00
# endif
2020-04-08 23:52:38 +00:00
2019-06-16 22:16:38 +00:00
void CPad : : Clear ( bool bResetPlayerControls )
2019-06-13 00:35:26 +00:00
{
NewState . Clear ( ) ;
OldState . Clear ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
PCTempKeyState . Clear ( ) ;
PCTempJoyState . Clear ( ) ;
PCTempMouseState . Clear ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
NewKeyState . Clear ( ) ;
OldKeyState . Clear ( ) ;
TempKeyState . Clear ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
NewMouseControllerState . Clear ( ) ;
OldMouseControllerState . Clear ( ) ;
PCTempMouseControllerState . Clear ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
Phase = 0 ;
ShakeFreq = 0 ;
ShakeDur = 0 ;
2020-06-27 21:31:45 +00:00
2020-08-16 14:10:59 +00:00
for ( int32 i = 0 ; i < DRUNK_STEERING_BUFFER_SIZE ; i + + )
SteeringLeftRightBuffer [ i ] = 0 ;
DrunkDrivingBufferUsed = 0 ;
2019-06-13 00:35:26 +00:00
if ( bResetPlayerControls )
2019-07-15 12:11:40 +00:00
DisablePlayerControls = PLAYERCONTROL_ENABLED ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
JustOutOfFrontend = 0 ;
2019-06-13 00:35:26 +00:00
bApplyBrakes = false ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
for ( int32 i = 0 ; i < HORNHISTORY_SIZE ; i + + )
2019-06-13 00:35:26 +00:00
bHornHistory [ i ] = false ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
iCurrHornHistory = 0 ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
for ( int32 i = 0 ; i < ARRAY_SIZE ( CheatString ) ; i + + )
CheatString [ i ] = ' ' ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
LastTimeTouched = CTimer : : GetTimeInMilliseconds ( ) ;
AverageWeapon = 0 ;
AverageEntries = 0 ;
}
2020-05-29 19:05:33 +00:00
uint32 CPad : : InputHowLongAgo ( )
{
return CTimer : : GetTimeInMilliseconds ( ) - LastTimeTouched ;
}
2019-06-13 00:35:26 +00:00
void CPad : : ClearMouseHistory ( )
{
PCTempMouseControllerState . Clear ( ) ;
NewMouseControllerState . Clear ( ) ;
OldMouseControllerState . Clear ( ) ;
}
2020-10-07 21:21:44 +00:00
// unused
void CPad : : ClearKeyBoardHistory ( )
{
NewKeyState . Clear ( ) ;
OldKeyState . Clear ( ) ;
TempKeyState . Clear ( ) ;
}
2019-06-02 03:00:38 +00:00
CMouseControllerState : : CMouseControllerState ( )
{
LMB = 0 ;
RMB = 0 ;
MMB = 0 ;
WHEELUP = 0 ;
WHEELDN = 0 ;
MXB1 = 0 ;
MXB2 = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-02 03:00:38 +00:00
x = 0.0f ;
y = 0.0f ;
}
void CMouseControllerState : : Clear ( )
{
LMB = 0 ;
RMB = 0 ;
MMB = 0 ;
WHEELUP = 0 ;
WHEELDN = 0 ;
MXB1 = 0 ;
MXB2 = 0 ;
}
CMouseControllerState CMousePointerStateHelper : : GetMouseSetUp ( )
{
2019-06-13 00:35:26 +00:00
CMouseControllerState state ;
2020-06-27 21:31:45 +00:00
2020-04-26 10:25:03 +00:00
# if defined RW_D3D9 || defined RWLIBS
2019-06-30 10:53:39 +00:00
if ( PSGLOBAL ( mouse ) = = nil )
2020-07-21 02:59:31 +00:00
_InputInitialiseMouse ( ! FrontEndMenuManager . m_bMenuActive & & _InputMouseNeedsExclusive ( ) ) ;
2020-06-27 21:31:45 +00:00
2019-06-30 10:53:39 +00:00
if ( PSGLOBAL ( mouse ) ! = nil )
2019-06-13 00:35:26 +00:00
{
DIDEVCAPS devCaps ;
devCaps . dwSize = sizeof ( DIDEVCAPS ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
PSGLOBAL ( mouse ) - > GetCapabilities ( & devCaps ) ;
switch ( devCaps . dwButtons )
{
case 3 :
case 4 :
case 5 :
case 6 :
case 7 :
case 8 :
state . MMB = true ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
state . RMB = true ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
state . LMB = true ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( devCaps . dwAxes = = 3 )
{
state . WHEELDN = true ;
state . WHEELUP = true ;
}
}
2020-04-26 10:25:03 +00:00
# else
// It seems there is no way to get number of buttons on mouse, so assign all buttons if we have mouse.
double xpos = 1.0f , ypos ;
glfwGetCursorPos ( PSGLOBAL ( window ) , & xpos , & ypos ) ;
2020-05-11 23:24:57 +00:00
if ( xpos ! = 0.f ) {
2020-04-26 10:25:03 +00:00
state . MMB = true ;
state . RMB = true ;
state . LMB = true ;
state . WHEELDN = true ;
state . WHEELUP = true ;
}
# endif
2019-06-13 00:35:26 +00:00
return state ;
2019-06-02 03:00:38 +00:00
}
2019-06-13 00:35:26 +00:00
void CPad : : UpdateMouse ( )
2019-05-31 17:02:26 +00:00
{
2020-07-24 17:43:51 +00:00
# if defined RW_D3D9 || defined RWLIBS
2019-06-13 00:35:26 +00:00
if ( IsForegroundApp ( ) )
{
2019-06-30 10:53:39 +00:00
if ( PSGLOBAL ( mouse ) = = nil )
2020-07-21 02:59:31 +00:00
_InputInitialiseMouse ( ! FrontEndMenuManager . m_bMenuActive & & _InputMouseNeedsExclusive ( ) ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
DIMOUSESTATE2 state ;
2020-06-27 21:31:45 +00:00
2019-06-30 10:53:39 +00:00
if ( PSGLOBAL ( mouse ) ! = nil & & SUCCEEDED ( _InputGetMouseState ( & state ) ) )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
int32 signX = 1 ;
int32 signy = 1 ;
2019-06-13 00:35:26 +00:00
if ( ! FrontEndMenuManager . m_bMenuActive )
{
if ( MousePointerStateHelper . bInvertVertically )
signy = - 1 ;
if ( MousePointerStateHelper . bInvertHorizontally )
signX = - 1 ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
PCTempMouseControllerState . Clear ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-16 22:16:38 +00:00
PCTempMouseControllerState . x = ( float ) ( signX * state . lX ) ;
PCTempMouseControllerState . y = ( float ) ( signy * state . lY ) ;
2019-06-13 00:35:26 +00:00
PCTempMouseControllerState . LMB = state . rgbButtons [ 0 ] & 128 ;
PCTempMouseControllerState . RMB = state . rgbButtons [ 1 ] & 128 ;
PCTempMouseControllerState . MMB = state . rgbButtons [ 2 ] & 128 ;
PCTempMouseControllerState . MXB1 = state . rgbButtons [ 3 ] & 128 ;
PCTempMouseControllerState . MXB2 = state . rgbButtons [ 4 ] & 128 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( state . lZ > 0 )
PCTempMouseControllerState . WHEELUP = 1 ;
else if ( state . lZ < 0 )
PCTempMouseControllerState . WHEELDN = 1 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
OldMouseControllerState = NewMouseControllerState ;
NewMouseControllerState = PCTempMouseControllerState ;
}
2020-07-24 17:43:51 +00:00
}
2020-04-26 10:25:03 +00:00
# else
2020-07-24 17:43:51 +00:00
if ( IsForegroundApp ( ) & & PSGLOBAL ( cursorIsInWindow ) )
{
2020-04-26 10:25:03 +00:00
double xpos = 1.0f , ypos ;
glfwGetCursorPos ( PSGLOBAL ( window ) , & xpos , & ypos ) ;
2020-05-11 23:24:57 +00:00
if ( xpos = = 0.f )
2020-04-26 10:25:03 +00:00
return ;
int32 signX = 1 ;
int32 signy = 1 ;
if ( ! FrontEndMenuManager . m_bMenuActive )
{
if ( MousePointerStateHelper . bInvertVertically )
signy = - 1 ;
if ( MousePointerStateHelper . bInvertHorizontally )
signX = - 1 ;
}
PCTempMouseControllerState . Clear ( ) ;
PCTempMouseControllerState . x = ( float ) ( signX * ( xpos - PSGLOBAL ( lastMousePos . x ) ) ) ;
PCTempMouseControllerState . y = ( float ) ( signy * ( ypos - PSGLOBAL ( lastMousePos . y ) ) ) ;
PCTempMouseControllerState . LMB = glfwGetMouseButton ( PSGLOBAL ( window ) , GLFW_MOUSE_BUTTON_LEFT ) ;
PCTempMouseControllerState . RMB = glfwGetMouseButton ( PSGLOBAL ( window ) , GLFW_MOUSE_BUTTON_RIGHT ) ;
PCTempMouseControllerState . MMB = glfwGetMouseButton ( PSGLOBAL ( window ) , GLFW_MOUSE_BUTTON_MIDDLE ) ;
PCTempMouseControllerState . MXB1 = glfwGetMouseButton ( PSGLOBAL ( window ) , GLFW_MOUSE_BUTTON_4 ) ;
PCTempMouseControllerState . MXB2 = glfwGetMouseButton ( PSGLOBAL ( window ) , GLFW_MOUSE_BUTTON_5 ) ;
if ( PSGLOBAL ( mouseWheel ) > 0 )
PCTempMouseControllerState . WHEELUP = 1 ;
else if ( PSGLOBAL ( mouseWheel ) < 0 )
PCTempMouseControllerState . WHEELDN = 1 ;
2020-04-29 15:53:05 +00:00
PSGLOBAL ( lastMousePos . x ) = xpos ;
PSGLOBAL ( lastMousePos . y ) = ypos ;
PSGLOBAL ( mouseWheel ) = 0.0f ;
2020-04-26 10:25:03 +00:00
OldMouseControllerState = NewMouseControllerState ;
NewMouseControllerState = PCTempMouseControllerState ;
2019-06-13 00:35:26 +00:00
}
2020-07-24 17:43:51 +00:00
# endif
2019-06-13 00:35:26 +00:00
}
CControllerState CPad : : ReconcileTwoControllersInput ( CControllerState const & State1 , CControllerState const & State2 )
{
static CControllerState ReconState ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
ReconState . Clear ( ) ;
2019-05-31 17:02:26 +00:00
2019-06-13 00:35:26 +00:00
# define _RECONCILE_BUTTON(button) \
{ if ( State1 . button | | State2 . button ) ReconState . button = 255 ; }
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
# define _RECONCILE_AXIS_POSITIVE(axis) \
2020-04-19 16:34:08 +00:00
{ if ( State1 . axis > = 0 & & State2 . axis > = 0 ) ReconState . axis = Max ( State1 . axis , State2 . axis ) ; }
2019-06-13 00:35:26 +00:00
# define _RECONCILE_AXIS_NEGATIVE(axis) \
2020-04-19 16:34:08 +00:00
{ if ( State1 . axis < = 0 & & State2 . axis < = 0 ) ReconState . axis = Min ( State1 . axis , State2 . axis ) ; }
2019-06-13 00:35:26 +00:00
# define _RECONCILE_AXIS(axis) \
{ _RECONCILE_AXIS_POSITIVE ( axis ) ; _RECONCILE_AXIS_NEGATIVE ( axis ) ; }
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
# define _FIX_AXIS_DIR(axis) \
{ if ( State1 . axis > 0 & & State2 . axis < 0 | | State1 . axis < 0 & & State2 . axis > 0 ) ReconState . axis = 0 ; }
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
# define _FIX_RECON_DIR(pos, neg, axis) \
{ if ( ( ReconState . pos | | ReconState . axis < 0 ) & & ( ReconState . neg | | ReconState . axis > 0 ) ) { ReconState . pos = 0 ; ReconState . neg = 0 ; ReconState . axis = 0 ; } }
_RECONCILE_BUTTON ( LeftShoulder1 ) ;
_RECONCILE_BUTTON ( LeftShoulder2 ) ;
_RECONCILE_BUTTON ( RightShoulder1 ) ;
_RECONCILE_BUTTON ( RightShoulder2 ) ;
_RECONCILE_BUTTON ( Start ) ;
_RECONCILE_BUTTON ( Select ) ;
_RECONCILE_BUTTON ( Square ) ;
_RECONCILE_BUTTON ( Triangle ) ;
_RECONCILE_BUTTON ( Cross ) ;
_RECONCILE_BUTTON ( Circle ) ;
_RECONCILE_BUTTON ( LeftShock ) ;
_RECONCILE_BUTTON ( RightShock ) ;
_RECONCILE_BUTTON ( NetworkTalk ) ;
_RECONCILE_AXIS ( LeftStickX ) ;
_RECONCILE_AXIS ( LeftStickY ) ;
_FIX_AXIS_DIR ( LeftStickX ) ;
_FIX_AXIS_DIR ( LeftStickY ) ;
_RECONCILE_AXIS ( RightStickX ) ;
_RECONCILE_AXIS ( RightStickY ) ;
_FIX_AXIS_DIR ( RightStickX ) ;
_FIX_AXIS_DIR ( RightStickY ) ;
_RECONCILE_BUTTON ( DPadUp ) ;
_RECONCILE_BUTTON ( DPadDown ) ;
_RECONCILE_BUTTON ( DPadLeft ) ;
_RECONCILE_BUTTON ( DPadRight ) ;
_FIX_RECON_DIR ( DPadUp , DPadDown , LeftStickY ) ;
_FIX_RECON_DIR ( DPadLeft , DPadRight , LeftStickX ) ;
return ReconState ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
# undef _RECONCILE_BUTTON
# undef _RECONCILE_AXIS_POSITIVE
# undef _RECONCILE_AXIS_NEGATIVE
# undef _RECONCILE_AXIS
# undef _FIX_AXIS_DIR
# undef _FIX_RECON_DIR
}
2019-06-16 22:16:38 +00:00
void CPad : : StartShake ( int16 nDur , uint8 nFreq )
2019-06-13 00:35:26 +00:00
{
2020-05-21 23:44:01 +00:00
if ( ! FrontEndMenuManager . m_PrefsUseVibration )
2019-06-13 00:35:26 +00:00
return ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:58:29 +00:00
if ( CCutsceneMgr : : IsRunning ( ) | | CGame : : playingIntro )
2019-06-13 00:35:26 +00:00
return ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( nFreq = = 0 )
{
ShakeDur = 0 ;
ShakeFreq = 0 ;
return ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( nDur > ShakeDur )
{
ShakeDur = nDur ;
ShakeFreq = nFreq ;
}
}
2019-05-31 17:02:26 +00:00
2019-06-16 22:16:38 +00:00
void CPad : : StartShake_Distance ( int16 nDur , uint8 nFreq , float fX , float fY , float fZ )
2019-06-13 00:35:26 +00:00
{
2020-05-21 23:44:01 +00:00
if ( ! FrontEndMenuManager . m_PrefsUseVibration )
2019-06-13 00:35:26 +00:00
return ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:58:29 +00:00
if ( CCutsceneMgr : : IsRunning ( ) | | CGame : : playingIntro )
2019-06-13 00:35:26 +00:00
return ;
2020-06-27 21:31:45 +00:00
2019-06-16 22:16:38 +00:00
float fDist = ( TheCamera . GetPosition ( ) - CVector ( fX , fY , fZ ) ) . Magnitude ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( fDist < 70.0f )
{
if ( nFreq = = 0 )
{
ShakeDur = 0 ;
ShakeFreq = 0 ;
return ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( nDur > ShakeDur )
{
ShakeDur = nDur ;
ShakeFreq = nFreq ;
}
}
}
2019-05-31 17:02:26 +00:00
2019-06-16 22:16:38 +00:00
void CPad : : StartShake_Train ( float fX , float fY )
2019-06-13 00:35:26 +00:00
{
2020-05-21 23:44:01 +00:00
if ( ! FrontEndMenuManager . m_PrefsUseVibration )
2019-06-13 00:35:26 +00:00
return ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:58:29 +00:00
if ( CCutsceneMgr : : IsRunning ( ) | | CGame : : playingIntro )
2019-06-13 00:35:26 +00:00
return ;
2020-06-27 21:31:45 +00:00
2019-06-30 10:53:39 +00:00
if ( FindPlayerVehicle ( ) ! = nil & & FindPlayerVehicle ( ) - > IsTrain ( ) )
2019-06-13 00:35:26 +00:00
return ;
2020-06-27 21:31:45 +00:00
2019-06-16 22:16:38 +00:00
float fDist = ( TheCamera . GetPosition ( ) - CVector ( fX , fY , 0.0f ) ) . Magnitude2D ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( fDist < 70.0f )
{
2019-06-16 22:16:38 +00:00
int32 freq = ( int32 ) ( ( 70.0f - fDist ) * 70.0f / 70.0f + 30.0f ) ;
2019-05-31 17:02:26 +00:00
2019-06-13 00:35:26 +00:00
if ( ShakeDur < 100 )
{
ShakeDur = 100 ;
ShakeFreq = freq ;
}
}
2019-05-31 17:02:26 +00:00
}
2020-04-09 03:20:44 +00:00
# ifdef GTA_PS2_STUFF
void CPad : : AddToCheatString ( char c )
{
for ( int32 i = ARRAY_SIZE ( CheatString ) - 2 ; i > = 0 ; i - - )
CheatString [ i + 1 ] = CheatString [ i ] ;
2020-06-27 21:31:45 +00:00
2020-04-15 05:03:53 +00:00
CheatString [ 0 ] = c ;
2020-04-09 03:20:44 +00:00
2020-06-27 21:31:45 +00:00
# define _CHEATCMP(str) strncmp(str, CheatString, sizeof(str)-1)
2020-04-09 03:20:44 +00:00
// "4414LDRULDRU" - R2 R2 L1 R2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
if ( ! _CHEATCMP ( " URDLURDL4144 " ) )
2020-06-03 21:48:26 +00:00
WeaponCheat1 ( ) ;
2020-04-09 03:20:44 +00:00
// "4411LDRULDRU" - R2 R2 L1 L1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
else if ( ! _CHEATCMP ( " URDLURDL1144 " ) )
MoneyCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "4412LDRULDRU" - R2 R2 L1 L2 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
else if ( ! _CHEATCMP ( " URDLURDL2144 " ) )
ArmourCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "4413LDRULDRU" - R2 R2 L1 R1 LEFT DOWN RIGHT UP LEFT DOWN RIGHT UP
else if ( ! _CHEATCMP ( " URDLURDL3144 " ) )
HealthCheat ( ) ;
// "4414LRLRLR" - R2 R2 L1 R2 LEFT RIGHT LEFT RIGHT LEFT RIGHT
else if ( ! _CHEATCMP ( " RLRLRL4144 " ) )
WantedLevelUpCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "4414UDUDUD" - R2 R2 L1 R2 UP DOWN UP DOWN UP DOWN
else if ( ! _CHEATCMP ( " DUDUDU4144 " ) )
WantedLevelDownCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "1234432T" - L1 L2 R1 R2 R2 R1 L2 TRIANGLE
else if ( ! _CHEATCMP ( " T2344321 " ) )
SunnyWeatherCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "1234432S" - L1 L2 R1 R2 R2 R1 L2 SQUARE
else if ( ! _CHEATCMP ( " S2344321 " ) )
CloudyWeatherCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "1234432C" - L1 L2 R1 R2 R2 R1 L2 CIRCLE
else if ( ! _CHEATCMP ( " C2344321 " ) )
RainyWeatherCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "1234432X" - L1 L2 R1 R2 R2 R1 L2 CROSS
else if ( ! _CHEATCMP ( " X2344321 " ) )
FoggyWeatherCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "CCCCCC321TCT" - CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE R1 L2 L1 TRIANGLE CIRCLE TRIANGLE
else if ( ! _CHEATCMP ( " TCT123CCCCCC " ) )
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_RHINO ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "CCCSSSSS1TCT" - CIRCLE CIRCLE CIRCLE SQUARE SQUARE SQUARE SQUARE SQUARE L1 TRIANGLE CIRCLE TRIANGLE
else if ( ! _CHEATCMP ( " TCT1SSSSSCCC " ) )
FastWeatherCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "241324TSCT21" - L2 R2 L1 R1 L2 R2 TRIANGLE SQUARE CIRCLE TRIANGLE L2 L1
else if ( ! _CHEATCMP ( " 12TCST423142 " ) )
BlowUpCarsCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "RDLU12ULDR" - RIGHT DOWN LEFT UP L1 L2 UP LEFT DOWN RIGHT
else if ( ! _CHEATCMP ( " RDLU21ULDR " ) )
ChangePlayerCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "DULUX3421" - DOWN UP LEFT UP CROSS R1 R2 L2 L1
else if ( ! _CHEATCMP ( " 1243XULUD " ) )
MayhemCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "DULUX3412" - DOWN UP LEFT UP CROSS R1 R2 L1 L2
else if ( ! _CHEATCMP ( " 2143XULUD " ) )
EverybodyAttacksPlayerCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "43TX21UD" - R2 R1 TRIANGLE CROSS L2 L1 UP DOWN
else if ( ! _CHEATCMP ( " DU12XT34 " ) )
WeaponsForAllCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "TURDS12" - TRIANGLE UP RIGHT DOWN SQUARE L1 L2
else if ( ! _CHEATCMP ( " 21SDRUT " ) )
FastTimeCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "TURDS34" - TRIANGLE UP RIGHT DOWN SQUARE R1 R2
else if ( ! _CHEATCMP ( " 43SDRUT " ) )
SlowTimeCheat ( ) ;
// "11S4T1T" - L1 L1 SQUARE R2 TRIANGLE L1 TRIANGLE
else if ( ! _CHEATCMP ( " T1T4S11 " ) )
OnlyRenderWheelsCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "R4C32D13" - RIGHT R2 CIRCLE R1 L2 DOWN L1 R1
else if ( ! _CHEATCMP ( " 31D23C4R " ) )
ChittyChittyBangBangCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
// "3141L33T" - R1 L1 R2 L1 LEFT R1 R1 TRIANGLE
else if ( ! _CHEATCMP ( " T33L1413 " ) )
StrongGripCheat ( ) ;
2020-06-27 21:31:45 +00:00
2020-04-09 03:20:44 +00:00
# undef _CHEATCMP
}
# endif
2020-06-05 21:20:29 +00:00
int Cheat_strncmp ( char * sourceStr , char * origCheatStr )
2020-06-05 01:19:53 +00:00
{
2020-12-25 08:44:20 +00:00
# define ccmp(n) if((uint8)sourceStr[i] != (uint8)origCheatStr[i] - n) return 1;
int i = 0 ;
while ( origCheatStr [ i ] )
{
switch ( i )
{
case 0 : ccmp ( 3 ) ; break ;
case 1 : ccmp ( 5 ) ; break ;
case 2 : ccmp ( 7 ) ; break ;
case 3 : ccmp ( 1 ) ; break ;
case 4 : ccmp ( 13 ) ; break ;
case 5 : ccmp ( 27 ) ; break ;
case 6 : ccmp ( 3 ) ; break ;
case 7 : ccmp ( 7 ) ; break ;
case 8 : ccmp ( 1 ) ; break ;
case 9 : ccmp ( 11 ) ; break ;
case 10 : ccmp ( 13 ) ; break ;
case 11 : ccmp ( 8 ) ; break ;
case 12 : ccmp ( 7 ) ; break ;
case 13 : ccmp ( 32 ) ; break ;
case 14 : ccmp ( 13 ) ; break ;
case 15 : ccmp ( 6 ) ; break ;
case 16 : ccmp ( 28 ) ; break ;
case 17 : ccmp ( 19 ) ; break ;
case 18 : ccmp ( 10 ) ; break ;
case 19 : ccmp ( 3 ) ; break ;
case 20 : ccmp ( 3 ) ; break ;
case 21 : ccmp ( 5 ) ; break ;
case 22 : ccmp ( 7 ) ; break ;
case 23 : ccmp ( 1 ) ; break ;
case 24 : ccmp ( 13 ) ; break ;
case 25 : ccmp ( 27 ) ; break ;
case 26 : ccmp ( 3 ) ; break ;
case 27 : ccmp ( 7 ) ; break ;
default : return 1 ;
2020-06-05 01:19:53 +00:00
}
2020-12-25 08:44:20 +00:00
i + + ;
2020-06-05 01:19:53 +00:00
}
return 0 ;
2020-12-25 08:44:20 +00:00
# undef ccmp
2020-06-05 01:19:53 +00:00
}
2020-10-07 21:21:44 +00:00
// TODO(Miami): Mobile has changed some of the cheats to include debugging things
2019-06-16 22:16:38 +00:00
void CPad : : AddToPCCheatString ( char c )
2019-05-29 16:06:33 +00:00
{
2020-06-05 01:19:53 +00:00
for ( int32 i = ARRAY_SIZE ( KeyBoardCheatString ) - 2 ; i > = 0 ; i - - )
2019-06-13 00:35:26 +00:00
KeyBoardCheatString [ i + 1 ] = KeyBoardCheatString [ i ] ;
2020-06-05 01:19:53 +00:00
2019-06-13 00:35:26 +00:00
KeyBoardCheatString [ 0 ] = c ;
2020-06-05 01:19:53 +00:00
# define _CHEATCMP(str) strncmp(str, KeyBoardCheatString, sizeof(str)-1)
2020-06-03 21:48:26 +00:00
// "THUGSTOOLS"
2020-06-05 21:20:29 +00:00
if ( ! Cheat_strncmp ( KeyBoardCheatString , " VQVPanJ \\ I_ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-03 21:48:26 +00:00
WeaponCheat1 ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-03 21:48:26 +00:00
// "PROFESSIONALTOOLS"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " VQVPagDUPT`[Lf \\ Xl " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-03 21:48:26 +00:00
WeaponCheat2 ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-03 21:48:26 +00:00
// "NUTTERTOOLS"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " VQVPamH[U`[ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-03 21:48:26 +00:00
WeaponCheat3 ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "PRECIOUSPROTECTION"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " QTPUP`WVS[`]ViPKnc " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-05 01:19:53 +00:00
ArmourCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-03 21:48:26 +00:00
// "ASPIRINE"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " HSPSVkVH " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2019-06-13 00:35:26 +00:00
HealthCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "YOUWONTTAKEMEALIVE"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " H[PMN`PLLLa \\ Uod[kl " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2019-06-13 00:35:26 +00:00
WantedLevelUpCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-03 21:48:26 +00:00
// "LEAVEMEALONE"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " HSVMN`PLWLRT " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2019-06-13 00:35:26 +00:00
WantedLevelDownCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "APLEASANTDAY"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " \\ FKU[ \\ VHFW]I " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
SunnyWeatherCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "ALOVELYDAY"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " \\ FKZY`YVML " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
ExtraSunnyWeatherCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "ABITDRIEG"
2020-08-30 20:47:12 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " JJPSQoLIB " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
CloudyWeatherCheat ( ) ;
}
2020-06-05 01:19:53 +00:00
// "CATSANDDOGS"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " VLVEQiDZULP " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
RainyWeatherCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "CANTSEEATHING"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " JSPIa \\ HLT_[IJ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-05 01:19:53 +00:00
FoggyWeatherCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-05-21 14:28:03 +00:00
// "PANZER"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " UJaONk " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_RHINO ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "LIFEISPASSINGMEBY"
2020-08-30 20:47:12 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " \\ GLNTiLZTL][PeSOh " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
FastWeatherCheat ( ) ;
}
2020-06-05 01:19:53 +00:00
// "BIGBANG"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " JSHCTdE " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-05 01:19:53 +00:00
BlowUpCarsCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "STILLLIKEDRESSINGUP"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " SZNOVnVLSORSPlYReg] " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-05 01:19:53 +00:00
ChangePlayerCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "FIGHTFIGHTFIGHT"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " WMNJSoKNJQaPNiS " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-05 01:19:53 +00:00
MayhemCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "NOBODYLIKESME"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " HRZFXdO`EZOWU " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-05 01:19:53 +00:00
EverybodyAttacksPlayerCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-05 01:19:53 +00:00
// "OURGODGIVENRIGHTTOBEARARMS"
2020-06-05 21:20:29 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " VRYB_ \\ HIP_aPNi_TaiSJGTNSbj " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-05 01:19:53 +00:00
WeaponsForAllCheat ( ) ;
2020-06-05 21:20:29 +00:00
}
2020-06-10 20:19:05 +00:00
// "ONSPEED"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " GJLQ`iR " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
FastTimeCheat ( ) ;
}
// "BOOOOOORING"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " JSPS \\ jRVPZO " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
SlowTimeCheat ( ) ;
}
// "WHEELSAREALLINEED"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " GJLOVgOHF]N[SeRNs " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
OnlyRenderWheelsCheat ( ) ;
}
//COMEFLYWITHME
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " HROUVr \\ SGPZWJ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-14 12:57:27 +00:00
ChittyChittyBangBangCheat ( ) ;
2020-06-10 20:19:05 +00:00
}
// "GRIPISEVERYTHING"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " JSPIatULWP`QWi_M " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
StrongGripCheat ( ) ;
}
// "CHASESTAT"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " WF[TRnDOD " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
DoShowChaseStatCheat ( ) ;
2020-06-10 20:19:05 +00:00
}
// "CHICKSWITHGUNS"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " VS \\ HUoL^TVPQOc " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-14 12:57:27 +00:00
DoChicksWithGunsCheat ( ) ;
2020-06-10 20:19:05 +00:00
}
// "ICANTTAKEITANYMORE"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " HWVNfiD[JPXI[t[G_ \\ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
SuicideCheat ( ) ;
}
// "GREENLIGHT"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " WMNJYiHLSR " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
TrafficLightsCheat ( ) ;
2020-06-10 20:19:05 +00:00
}
// "MIAMITRAFFIC"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " FNMGNmWPNLVU " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-16 15:39:11 +00:00
MadCarsCheat ( ) ;
2020-06-10 20:19:05 +00:00
}
// "AHAIRDRESSERSCAR"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " UFJT_`VZF]QZPaUG " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
PinkCarsCheat ( ) ;
}
// "IWANTITPAINTEDBLACK"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " NHHMO_H[OTNX[iaT]jS " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
BlackCarsCheat ( ) ;
}
2020-05-21 14:28:03 +00:00
// "TRAVELINSTYLE"
2020-06-10 20:19:05 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " HQ`U`iLSFaNZ[ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_BLOODRA ) ;
2020-06-10 20:19:05 +00:00
}
2020-05-21 14:28:03 +00:00
// "THELASTRIDE"
2020-06-10 20:19:05 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " HIPSanDSFSa " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_ROMERO ) ;
2020-06-10 20:19:05 +00:00
}
2020-05-21 14:28:03 +00:00
// "ROCKANDROLLCAR"
2020-06-10 20:19:05 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " UFJMYjUKOLXKVr " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_LOVEFIST ) ;
2020-06-10 20:19:05 +00:00
}
2020-05-21 14:28:03 +00:00
// "RUBBISHCAR"
2020-06-10 20:19:05 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " UFJI`dEIV] " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_TRASH ) ;
2020-06-10 20:19:05 +00:00
}
// "GETTHEREQUICKLY"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " \\ QRDVpTLSPU \\ [eT " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_BLOODRB ) ;
2020-06-10 20:19:05 +00:00
}
// "GETTHEREFAST"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " WXHGRmHOU_RO " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_SABRETUR ) ;
2020-06-10 20:19:05 +00:00
}
2020-05-21 14:28:03 +00:00
// "BETTERTHANWALKING"
2020-06-10 20:19:05 +00:00
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " JSPLY \\ ZUBSaZLtaK^ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_CADDY ) ;
2020-06-10 20:19:05 +00:00
}
// "GETTHEREFASTINDEED"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " GJLE[dWZBQfZLvRXa[^WHL " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_HOTRINA ) ;
2020-06-10 20:19:05 +00:00
}
// "GETTHEREAMAZINGLYFAST"
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " WXHGfgJUJeNUHe_Kdg^HJ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-08-30 20:47:12 +00:00
VehicleCheat ( MI_HOTRINB ) ;
2020-06-10 20:19:05 +00:00
}
// LOOKLIKELANCE
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " HHUBY`NPMV \\ WS " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igbuddy " ) ;
}
// IWANTBIGTITS
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " VYPUTdE[OLdQ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igcandy " ) ;
}
// MYSONISALAWYER
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " UJ`XNgDZJY \\ [`m " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igken " ) ;
}
// ILOOKLIKEHILARY
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " \\ WHMVcHRJWXWVlV " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " ighlary " ) ;
}
// ROCKANDROLLMAN
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " QFTMYjUKOLXKVr " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igjezz " ) ;
}
// ONEARMEDBANDIT
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " WNKON]GLN]NMUo " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igphil " ) ;
}
// IDONTHAVETHEMONEYSONNY
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " \\ SUP`tHUPXRP[ecGdgXRGN " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igsonny " ) ;
}
// FOXYLITTLETHING
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " JSPIa`O[UTYa_oS " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igmerc " ) ;
}
// WELOVEOURDICK
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " NHPE_pRLWZYM^ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igdick " ) ;
}
// CHEATSHAVEBEENCRACKED
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " GJRDNmFUFPOM]aUYpTOKF " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
ChangePlayerModel ( " igdiaz " ) ;
}
2020-08-30 20:47:12 +00:00
// DEEPFRIEDMARSBARS
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " VWHC`mDTEPVZMpRK " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
gfTommyFatness = 0.26f ;
}
// PROGRAMMER
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " UJTNNmJVS[ " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
gfTommyFatness = - 0.3f ;
}
2020-06-10 20:19:05 +00:00
// SEAWAYS
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " V^HXN`V " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
BackToTheFuture ( ) ;
}
2020-10-07 21:21:44 +00:00
// LOADSOFLITTLETHINGS
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " VLUJUoHSU_VTMo`J]bV " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
SpecialCarCheats ( ) ;
}
// HOPINGIRL
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " OWPH[dSVI " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
PickUpChicksCheat ( ) ;
}
2020-06-10 20:19:05 +00:00
//CERTAINDEATH
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " KYHFQiLHU]RK " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
2020-06-14 12:57:27 +00:00
CSmokeTrails : : CigOn = ! CSmokeTrails : : CigOn ;
}
//AIRSHIP
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " SNOT_dD " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
FlyingFishCheat ( ) ;
}
//FANNYMAGNET
else if ( ! Cheat_strncmp ( KeyBoardCheatString , " WJUHNh \\ UOLS " ) ) {
KeyBoardCheatString [ 0 ] = ' ' ;
FannyMagnetCheat ( ) ;
2020-06-10 20:19:05 +00:00
}
2020-06-05 01:19:53 +00:00
2019-07-01 19:46:44 +00:00
# ifdef KANGAROO_CHEAT
// "KANGAROO"
if ( ! _CHEATCMP ( " OORAGNAK " ) )
KangarooCheat ( ) ;
# endif
2019-08-16 16:25:02 +00:00
# ifndef MASTER
// "PEDDEBUG"
if ( ! _CHEATCMP ( " GUBEDDEP " ) )
CPed : : SwitchDebugDisplay ( ) ;
# endif
2020-04-25 18:25:14 +00:00
2020-09-28 23:29:10 +00:00
# ifdef RESTORE_ALLCARSHELI_CHEAT
2020-04-25 18:25:14 +00:00
// "CARSAREHELI"
if ( ! _CHEATCMP ( " ILEHERASRAC " ) )
AllCarsHeliCheat ( ) ;
# endif
2020-09-11 15:46:16 +00:00
# ifdef WALLCLIMB_CHEAT
// "SPIDERCAR"
if ( ! _CHEATCMP ( " RACREDIPS " ) )
WallClimbingCheat ( ) ;
# endif
2020-05-27 21:15:37 +00:00
# if !defined(PC_WATER) && defined(WATER_CHEATS)
// SEABEDCHEAT
if ( ! _CHEATCMP ( " TAEHCDEBAESON " ) )
NoSeaBedCheat ( ) ;
2020-06-05 01:19:53 +00:00
2020-05-27 21:15:37 +00:00
// WATERLAYERSCHEAT
if ( ! _CHEATCMP ( " TAEHCSREYALRETAW " ) )
RenderWaterLayersCheat ( ) ;
# endif
2020-05-28 16:53:54 +00:00
2020-06-05 01:19:53 +00:00
# undef _CHEATCMP
2019-06-13 00:35:26 +00:00
}
2020-03-27 18:54:35 +00:00
# ifdef XINPUT
void CPad : : AffectFromXinput ( uint32 pad )
{
XINPUT_STATE xstate ;
memset ( & xstate , 0 , sizeof ( XINPUT_STATE ) ) ;
if ( XInputGetState ( pad , & xstate ) = = ERROR_SUCCESS )
{
PCTempJoyState . Circle = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_B ) ? 255 : 0 ;
PCTempJoyState . Cross = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_A ) ? 255 : 0 ;
PCTempJoyState . Square = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_X ) ? 255 : 0 ;
PCTempJoyState . Triangle = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_Y ) ? 255 : 0 ;
PCTempJoyState . DPadDown = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_DPAD_DOWN ) ? 255 : 0 ;
PCTempJoyState . DPadLeft = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_DPAD_LEFT ) ? 255 : 0 ;
PCTempJoyState . DPadRight = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_DPAD_RIGHT ) ? 255 : 0 ;
PCTempJoyState . DPadUp = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_DPAD_UP ) ? 255 : 0 ;
PCTempJoyState . LeftShock = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_LEFT_THUMB ) ? 255 : 0 ;
PCTempJoyState . LeftShoulder1 = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER ) ? 255 : 0 ;
PCTempJoyState . LeftShoulder2 = xstate . Gamepad . bLeftTrigger ;
PCTempJoyState . RightShock = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_RIGHT_THUMB ) ? 255 : 0 ;
PCTempJoyState . RightShoulder1 = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER ) ? 255 : 0 ;
PCTempJoyState . RightShoulder2 = xstate . Gamepad . bRightTrigger ;
PCTempJoyState . Select = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_BACK ) ? 255 : 0 ;
2020-03-28 14:47:52 +00:00
# ifdef REGISTER_START_BUTTON
2020-03-27 18:54:35 +00:00
PCTempJoyState . Start = ( xstate . Gamepad . wButtons & XINPUT_GAMEPAD_START ) ? 255 : 0 ;
2020-03-28 14:47:52 +00:00
# endif
2020-03-27 18:54:35 +00:00
float lx = ( float ) xstate . Gamepad . sThumbLX / ( float ) 0x7FFF ;
float ly = ( float ) xstate . Gamepad . sThumbLY / ( float ) 0x7FFF ;
float rx = ( float ) xstate . Gamepad . sThumbRX / ( float ) 0x7FFF ;
float ry = ( float ) xstate . Gamepad . sThumbRY / ( float ) 0x7FFF ;
if ( Abs ( lx ) > 0.3f | | Abs ( ly ) > 0.3f ) {
PCTempJoyState . LeftStickX = ( int32 ) ( lx * 128.0f ) ;
PCTempJoyState . LeftStickY = ( int32 ) ( - ly * 128.0f ) ;
}
if ( Abs ( rx ) > 0.3f | | Abs ( ry ) > 0.3f ) {
PCTempJoyState . RightStickX = ( int32 ) ( rx * 128.0f ) ;
2020-05-02 22:42:05 +00:00
PCTempJoyState . RightStickY = ( int32 ) ( - ry * 128.0f ) ;
2020-03-27 18:54:35 +00:00
}
2020-03-28 02:53:42 +00:00
XINPUT_VIBRATION VibrationState ;
memset ( & VibrationState , 0 , sizeof ( XINPUT_VIBRATION ) ) ;
uint16 iLeftMotor = ( uint16 ) ( ( float ) ShakeFreq / 255.0f * ( float ) 0xffff ) ;
uint16 iRightMotor = ( uint16 ) ( ( float ) ShakeFreq / 255.0f * ( float ) 0xffff ) ;
2020-06-27 21:31:45 +00:00
2020-03-28 02:53:42 +00:00
if ( ShakeDur < CTimer : : GetTimeStepInMilliseconds ( ) )
ShakeDur = 0 ;
else
ShakeDur - = CTimer : : GetTimeStepInMilliseconds ( ) ;
if ( ShakeDur = = 0 ) ShakeFreq = 0 ;
VibrationState . wLeftMotorSpeed = iLeftMotor ;
VibrationState . wRightMotorSpeed = iRightMotor ;
XInputSetState ( pad , & VibrationState ) ;
2020-03-27 18:54:35 +00:00
}
}
# endif
2020-06-27 21:31:45 +00:00
void CPad : : UpdatePads ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
bool bUpdate = true ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
GetPad ( 0 ) - > UpdateMouse ( ) ;
2020-03-27 18:54:35 +00:00
# ifdef XINPUT
2020-06-08 11:00:45 +00:00
GetPad ( 0 ) - > AffectFromXinput ( m_bMapPadOneToPadTwo ? 1 : 0 ) ;
GetPad ( 1 ) - > AffectFromXinput ( m_bMapPadOneToPadTwo ? 0 : 1 ) ;
2020-03-27 18:54:35 +00:00
# else
2019-06-13 00:35:26 +00:00
CapturePad ( 0 ) ;
2020-03-27 18:54:35 +00:00
# endif
2020-07-24 17:43:51 +00:00
// Improve keyboard input latency part 1
# ifdef FIX_BUGS
OldKeyState = NewKeyState ;
NewKeyState = TempKeyState ;
# endif
2020-05-02 16:00:47 +00:00
# ifdef DETECT_PAD_INPUT_SWITCH
2020-05-29 19:05:33 +00:00
if ( GetPad ( 0 ) - > PCTempJoyState . CheckForInput ( ) )
2020-05-02 16:00:47 +00:00
IsAffectedByController = true ;
else {
# endif
ControlsManager . ClearSimButtonPressCheckers ( ) ;
ControlsManager . AffectPadFromKeyBoard ( ) ;
ControlsManager . AffectPadFromMouse ( ) ;
2019-06-13 00:35:26 +00:00
2020-05-02 16:00:47 +00:00
# ifdef DETECT_PAD_INPUT_SWITCH
}
2020-05-29 19:05:33 +00:00
if ( IsAffectedByController & & ( GetPad ( 0 ) - > PCTempKeyState . CheckForInput ( ) | | GetPad ( 0 ) - > PCTempMouseState . CheckForInput ( ) ) )
2020-05-02 16:00:47 +00:00
IsAffectedByController = false ;
# endif
2020-06-27 21:31:45 +00:00
2020-05-29 19:05:33 +00:00
if ( CReplay : : IsPlayingBackFromFile ( ) & & ! FrontEndMenuManager . m_bMenuActive )
2019-06-13 00:35:26 +00:00
bUpdate = false ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( bUpdate )
GetPad ( 0 ) - > Update ( 0 ) ;
2020-03-27 18:54:35 +00:00
2021-01-02 11:28:23 +00:00
# ifndef MASTER
GetPad ( 1 ) - > Update ( 1 ) ;
# else
2019-06-13 00:35:26 +00:00
GetPad ( 1 ) - > NewState . Clear ( ) ;
GetPad ( 1 ) - > OldState . Clear ( ) ;
2020-03-27 18:54:35 +00:00
# endif
2020-06-27 21:31:45 +00:00
2020-07-24 17:43:51 +00:00
// Improve keyboard input latency part 2
# ifndef FIX_BUGS
2019-06-13 00:35:26 +00:00
OldKeyState = NewKeyState ;
NewKeyState = TempKeyState ;
2020-07-24 17:43:51 +00:00
# endif
2019-05-29 16:06:33 +00:00
}
2019-06-13 00:35:26 +00:00
void CPad : : ProcessPCSpecificStuff ( void )
2019-05-29 16:06:33 +00:00
{
2019-06-13 00:35:26 +00:00
;
}
2020-06-27 21:01:51 +00:00
void CPad : : Update ( int16 pad )
2019-06-13 00:35:26 +00:00
{
OldState = NewState ;
2020-06-27 21:01:51 +00:00
# ifdef GTA_PS2
bObsoleteControllerMessage = false ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
//int iPressureBtn;
int id ;
int ext_id = 0 ;
int state ;
int rterm_id = 0 ;
unsigned short paddata , tpad ;
unsigned char rdata [ 32 ] ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
state = scePadGetState ( pad , 0 ) ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
switch ( Phase )
2020-06-27 21:31:45 +00:00
{
case 0 :
if ( state ! = scePadStateStable & & state ! = scePadStateFindCTP1 )
2020-06-27 21:01:51 +00:00
break ;
id = scePadInfoMode ( pad , 0 , InfoModeCurID , 0 ) ;
2020-06-27 21:31:45 +00:00
if ( id = = 0 ) break ;
2020-06-27 21:01:51 +00:00
ext_id = scePadInfoMode ( pad , 0 , InfoModeCurExID , 0 ) ;
if ( ext_id > 0 ) id = ext_id ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
switch ( id )
{
case 4 : // Digital controller
Phase = 40 ; // Try for analog(dualshock)
break ;
case 7 : // Dualshock2 controller
Phase = 50 ;
break ;
default :
Phase = 99 ;
break ;
}
break ;
// Analog Controller (old dualshock)
2020-06-27 21:31:45 +00:00
case 40 : // Analog Contoller check valid (otherwise fail phase)
2020-06-27 21:01:51 +00:00
if ( scePadInfoMode ( pad , 0 , InfoModeIdTable , - 1 ) = = 0 )
{
Phase = 99 ;
break ;
}
Phase + + ;
2020-06-27 21:31:45 +00:00
case 41 : // Analog controller: Request Lock analog mode (asynchronous)
2020-06-27 21:01:51 +00:00
if ( scePadSetMainMode ( pad , 0 , 1 , 3 ) = = 1 ) Phase + + ;
break ;
2020-06-27 21:31:45 +00:00
case 42 : // Analog controller: Check state of previous request
2020-06-27 21:01:51 +00:00
if ( scePadGetReqState ( pad , 0 ) = = scePadReqStateFaild )
{
Phase - - ;
}
if ( scePadGetReqState ( pad , 0 ) = = scePadReqStateComplete )
2020-06-27 21:31:45 +00:00
{
2020-06-27 21:01:51 +00:00
// Lock mode complete
Phase = 0 ; // Accept normal dualshock
}
break ;
2020-06-27 21:31:45 +00:00
// DualShock 2 Controller
case 50 : // Analog Contoller check valid (otherwise fail phase)
2020-06-27 21:01:51 +00:00
if ( scePadInfoMode ( pad , 0 , InfoModeIdTable , - 1 ) = = 0 )
{
Phase = 99 ;
break ;
}
Phase + + ;
2020-06-27 21:31:45 +00:00
case 51 : // Analog controller: Request Lock analog mode (asynchronous)
2020-06-27 21:01:51 +00:00
if ( scePadSetMainMode ( pad , 0 , 1 , 3 ) = = 1 ) Phase + + ;
break ;
2020-06-27 21:31:45 +00:00
case 52 : // Analog controller: Check state of previous request
2020-06-27 21:01:51 +00:00
if ( scePadGetReqState ( pad , 0 ) = = scePadReqStateFaild )
{
Phase - - ;
}
if ( scePadGetReqState ( pad , 0 ) = = scePadReqStateComplete )
2020-06-27 21:31:45 +00:00
{
2020-06-27 21:01:51 +00:00
// Lock mode complete
Phase = 0 ; // Accept normal dualshock
}
break ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
case 70 : // DualShock 2 check pressure sensitive possible
if ( scePadInfoPressMode ( pad , 0 ) = = 1 )
{
Phase = 76 ;
break ;
}
Phase = 99 ;
break ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
case 76 : // DualShock2 enable pressure sensitive mode (asynchronous function)
if ( scePadEnterPressMode ( pad , 0 ) = = 1 ) Phase + + ;
break ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
case 77 : // Dualshock2 check status of request pressure sensitive mode
if ( scePadGetReqState ( pad , 0 ) = = scePadReqStateFaild ) Phase - - ;
if ( scePadGetReqState ( pad , 0 ) = = scePadReqStateComplete )
{
Phase = 80 ;
}
break ;
2020-06-27 21:31:45 +00:00
// DualShock 2 Controller
case 80 : // Set motors
2020-06-27 21:01:51 +00:00
if ( scePadInfoAct ( pad , 0 , - 1 , 0 ) = = 0 )
{
Phase = 99 ;
}
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
act_align [ 0 ] = 0 ; // Offset 0 for motor0
act_align [ 1 ] = 1 ; // Offset 1 for motor1
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
act_align [ 2 ] = 0xff ;
act_align [ 3 ] = 0xff ;
act_align [ 4 ] = 0xff ;
act_align [ 5 ] = 0xff ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
// Asynchronous function
if ( scePadSetActAlign ( pad , 0 , act_align ) = = 0 ) break ;
Phase + + ;
break ;
2020-06-27 21:31:45 +00:00
case 81 :
2020-06-27 21:01:51 +00:00
if ( scePadGetState ( pad , 0 ) ! = scePadStateExecCmd )
{
Phase = 99 ;
}
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
break ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
default :
if ( state = = scePadStateError ) break ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
if ( state = = scePadStateStable | | state = = scePadStateFindCTP1 )
{
if ( ShakeDur )
{
2020-11-16 08:48:15 +00:00
ShakeDur = Max ( ShakeDur - ( int32 ) CTimer : : GetTimeStepInMilliseconds ( ) , 0 ) ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
if ( ShakeDur = = 0 )
{
act_direct [ 0 ] = 0 ;
act_direct [ 1 ] = 0 ;
scePadSetActDirect ( pad , 0 , act_direct ) ;
}
else
{
act_direct [ 0 ] = 0 ;
act_direct [ 1 ] = ( unsigned char ) ShakeFreq ;
scePadSetActDirect ( pad , 0 , act_direct ) ;
}
}
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
if ( scePadRead ( pad , 0 , rdata ) = = 0 )
{
NewState . Clear ( ) ;
break ;
}
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
if ( ( rdata [ 0 ] = = 0 ) )
{
paddata = ( unsigned short ) ( 0xffff ^ ( ( rdata [ 2 ] < < 8 ) | rdata [ 3 ] ) ) ;
rterm_id = ( rdata [ 1 ] ) ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
if ( ( rterm_id > > 4 ) = = 7 ) // DUALSHOCK
{
if ( ! CRecordDataForGame : : IsPlayingBack ( ) & & ! CRecordDataForChase : : ShouldThisPadBeLeftAlone ( pad ) )
{
tpad = paddata ;
2020-06-27 21:31:45 +00:00
NewState . DPadUp = ( tpad & SCE_PADLup ) ? 255 : 0 ;
NewState . DPadDown = ( tpad & SCE_PADLdown ) ? 255 : 0 ;
NewState . DPadLeft = ( tpad & SCE_PADLleft ) ? 255 : 0 ;
NewState . DPadRight = ( tpad & SCE_PADLright ) ? 255 : 0 ;
NewState . Triangle = ( tpad & SCE_PADRup ) ? 255 : 0 ;
NewState . Cross = ( tpad & SCE_PADRdown ) ? 255 : 0 ;
NewState . Square = ( tpad & SCE_PADRleft ) ? 255 : 0 ;
NewState . Circle = ( tpad & SCE_PADRright ) ? 255 : 0 ;
NewState . Start = ( tpad & SCE_PADstart ) ? 255 : 0 ;
NewState . Select = ( tpad & SCE_PADselect ) ? 255 : 0 ;
NewState . LeftShoulder1 = ( tpad & SCE_PADL1 ) ? 255 : 0 ;
NewState . LeftShoulder2 = ( tpad & SCE_PADL2 ) ? 255 : 0 ;
NewState . RightShoulder1 = ( tpad & SCE_PADR1 ) ? 255 : 0 ;
NewState . RightShoulder2 = ( tpad & SCE_PADR2 ) ? 255 : 0 ;
NewState . LeftShock = ( tpad & SCE_PADi ) ? 255 : 0 ;
NewState . RightShock = ( tpad & SCE_PADj ) ? 255 : 0 ;
NewState . RightStickX = ( short ) rdata [ 4 ] ;
NewState . RightStickY = ( short ) rdata [ 5 ] ;
NewState . LeftStickX = ( short ) rdata [ 6 ] ;
NewState . LeftStickY = ( short ) rdata [ 7 ] ;
2020-06-27 21:01:51 +00:00
# define CLAMP_AXIS(x) (((x) < 43 && (x) >= -42) ? 0 : (((x) > 0) ? (Max((x)-42, 0)*127 / 85) : Min((x)+42, 0)*127 / 85))
# define FIX_AXIS(x) CLAMP_AXIS((x)-128)
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
NewState . RightStickX = FIX_AXIS ( NewState . RightStickX ) ;
NewState . RightStickY = FIX_AXIS ( NewState . RightStickY ) ;
2020-06-27 21:31:45 +00:00
NewState . LeftStickX = FIX_AXIS ( NewState . LeftStickX ) ;
NewState . LeftStickY = FIX_AXIS ( NewState . LeftStickY ) ;
2020-06-27 21:01:51 +00:00
# undef FIX_AXIS
# undef CLAMP_AXIS
}
}
else if ( ( rterm_id > > 4 ) = = 4 ) // Controller (digital)
{
if ( pad = = 0 )
bObsoleteControllerMessage = true ;
NewState . Clear ( ) ;
}
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
if ( NewState . IsAnyButtonPressed ( ) )
LastTimeTouched = CTimer : : GetTimeInMilliseconds ( ) ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
if ( + + iCurrHornHistory > = HORNHISTORY_SIZE )
iCurrHornHistory = 0 ;
bHornHistory [ iCurrHornHistory ] = GetHorn ( ) ;
NewState . Clear ( ) ;
return ;
}
break ;
2020-06-27 21:31:45 +00:00
}
2020-06-27 21:01:51 +00:00
if ( pad = = 0 )
{
bOldDisplayNoControllerMessage = bDisplayNoControllerMessage ;
if ( state = = scePadStateDiscon )
{
bDisplayNoControllerMessage = true ;
Phase = 0 ;
}
else
bDisplayNoControllerMessage = false ;
}
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
if ( + + iCurrHornHistory > = HORNHISTORY_SIZE )
iCurrHornHistory = 0 ;
bHornHistory [ iCurrHornHistory ] = GetHorn ( ) ;
if ( ! bDisplayNoControllerMessage )
CGame : : bDemoMode = false ;
# endif
2020-06-27 21:31:45 +00:00
2020-04-10 08:03:38 +00:00
# if (defined GTA_PS2 || defined FIX_BUGS)
2020-06-27 21:01:51 +00:00
if ( ! CRecordDataForGame : : IsPlayingBack ( ) & & ! CRecordDataForChase : : ShouldThisPadBeLeftAlone ( pad ) )
2020-04-10 08:03:38 +00:00
# endif
{
NewState = ReconcileTwoControllersInput ( PCTempKeyState , PCTempJoyState ) ;
NewState = ReconcileTwoControllersInput ( PCTempMouseState , NewState ) ;
}
2019-06-13 00:35:26 +00:00
PCTempJoyState . Clear ( ) ;
PCTempKeyState . Clear ( ) ;
PCTempMouseState . Clear ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
ProcessPCSpecificStuff ( ) ;
2020-05-29 19:05:33 +00:00
if ( NewState . CheckForInput ( ) )
LastTimeTouched = CTimer : : GetTimeInMilliseconds ( ) ;
2019-06-13 00:35:26 +00:00
2020-04-09 03:20:44 +00:00
if ( + + iCurrHornHistory > = HORNHISTORY_SIZE )
2019-06-13 00:35:26 +00:00
iCurrHornHistory = 0 ;
bHornHistory [ iCurrHornHistory ] = GetHorn ( ) ;
2020-08-16 14:10:59 +00:00
for ( int32 i = DRUNK_STEERING_BUFFER_SIZE - 2 ; i > = 0 ; i - - ) {
SteeringLeftRightBuffer [ i + 1 ] = SteeringLeftRightBuffer [ i ] ;
}
2019-06-13 00:35:26 +00:00
if ( ! bDisplayNoControllerMessage )
CGame : : bDemoMode = false ;
2020-10-07 21:21:44 +00:00
if ( JustOutOfFrontend ! = 0 )
- - JustOutOfFrontend ;
2019-06-13 00:35:26 +00:00
}
void CPad : : DoCheats ( void )
{
2020-05-02 16:00:47 +00:00
# ifdef DETECT_PAD_INPUT_SWITCH
if ( IsAffectedByController )
# endif
GetPad ( 0 ) - > DoCheats ( 0 ) ;
2019-06-13 00:35:26 +00:00
}
2019-06-16 22:16:38 +00:00
void CPad : : DoCheats ( int16 unk )
2019-06-13 00:35:26 +00:00
{
2020-04-09 03:20:44 +00:00
# ifdef GTA_PS2_STUFF
2019-06-13 00:35:26 +00:00
if ( GetTriangleJustDown ( ) )
AddToCheatString ( ' T ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetCircleJustDown ( ) )
AddToCheatString ( ' C ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetCrossJustDown ( ) )
AddToCheatString ( ' X ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetSquareJustDown ( ) )
AddToCheatString ( ' S ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetDPadUpJustDown ( ) )
AddToCheatString ( ' U ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetDPadDownJustDown ( ) )
AddToCheatString ( ' D ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetDPadLeftJustDown ( ) )
AddToCheatString ( ' L ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetDPadRightJustDown ( ) )
AddToCheatString ( ' R ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetLeftShoulder1JustDown ( ) )
AddToCheatString ( ' 1 ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetLeftShoulder2JustDown ( ) )
AddToCheatString ( ' 2 ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetRightShoulder1JustDown ( ) )
AddToCheatString ( ' 3 ' ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetRightShoulder2JustDown ( ) )
AddToCheatString ( ' 4 ' ) ;
# endif
}
void CPad : : StopPadsShaking ( void )
{
GetPad ( 0 ) - > StopShaking ( 0 ) ;
}
2020-06-27 21:01:51 +00:00
void CPad : : StopShaking ( int16 pad )
2019-06-13 00:35:26 +00:00
{
2020-06-27 21:01:51 +00:00
# ifdef GTA_PS2_STUFF
ShakeFreq = 0 ;
ShakeDur = 0 ;
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
# ifdef GTA_PS2
if ( Phase = = 99 )
{
act_direct [ 0 ] = 0 ;
act_direct [ 1 ] = 0 ;
scePadSetActDirect ( pad , 0 , act_direct ) ;
}
# endif
2020-06-27 21:31:45 +00:00
2020-06-27 21:01:51 +00:00
# endif
2019-06-13 00:35:26 +00:00
}
2019-06-16 22:16:38 +00:00
CPad * CPad : : GetPad ( int32 pad )
2019-06-13 00:35:26 +00:00
{
return & Pads [ pad ] ;
}
2020-05-02 21:11:02 +00:00
# ifdef DETECT_PAD_INPUT_SWITCH
# define CURMODE (IsAffectedByController ? Mode : 0)
# else
# define CURMODE (Mode)
# endif
2019-06-16 22:16:38 +00:00
int16 CPad : : GetSteeringLeftRight ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
2020-08-16 14:10:59 +00:00
int16 value ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
{
2019-06-16 22:16:38 +00:00
int16 axis = NewState . LeftStickX ;
int16 dpad = ( NewState . DPadRight - NewState . DPadLeft ) / 2 ;
2020-06-27 21:31:45 +00:00
2019-07-10 15:18:26 +00:00
if ( Abs ( axis ) > Abs ( dpad ) )
2020-08-16 14:10:59 +00:00
value = axis ;
2019-06-13 00:35:26 +00:00
else
2020-08-16 14:10:59 +00:00
value = dpad ;
SteeringLeftRightBuffer [ 0 ] = value ;
value = SteeringLeftRightBuffer [ DrunkDrivingBufferUsed ] ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
case 3 :
{
2020-08-16 14:10:59 +00:00
SteeringLeftRightBuffer [ 0 ] = NewState . LeftStickX ;
value = SteeringLeftRightBuffer [ DrunkDrivingBufferUsed ] ;
break ;
}
default :
{
value = 0 ;
2019-06-13 00:35:26 +00:00
break ;
}
2019-05-29 16:06:33 +00:00
}
2020-06-27 21:31:45 +00:00
2020-08-16 14:10:59 +00:00
return value ;
2019-06-13 00:35:26 +00:00
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetSteeringUpDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
{
2019-06-16 22:16:38 +00:00
int16 axis = NewState . LeftStickY ;
2020-06-24 17:11:33 +00:00
int16 dpad = ( NewState . DPadDown - NewState . DPadUp ) / 2 ;
2020-06-27 21:31:45 +00:00
2019-07-10 15:18:26 +00:00
if ( Abs ( axis ) > Abs ( dpad ) )
2019-06-13 00:35:26 +00:00
return axis ;
else
return dpad ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
case 3 :
{
return NewState . LeftStickY ;
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetCarGunUpDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 2 :
{
return NewState . RightStickY ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ( NewState . DPadUp - NewState . DPadDown ) / 2 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
2019-05-29 16:06:33 +00:00
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetCarGunLeftRight ( void )
2019-05-29 16:06:33 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 2 :
{
return NewState . RightStickX ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ( NewState . DPadRight - NewState . DPadLeft ) / 2 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetPedWalkLeftRight ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
{
2019-06-16 22:16:38 +00:00
int16 axis = NewState . LeftStickX ;
int16 dpad = ( NewState . DPadRight - NewState . DPadLeft ) / 2 ;
2020-06-27 21:31:45 +00:00
2019-07-10 15:18:26 +00:00
if ( Abs ( axis ) > Abs ( dpad ) )
2019-06-13 00:35:26 +00:00
return axis ;
else
return dpad ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
case 3 :
{
return NewState . LeftStickX ;
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetPedWalkUpDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
{
2019-06-16 22:16:38 +00:00
int16 axis = NewState . LeftStickY ;
int16 dpad = ( NewState . DPadDown - NewState . DPadUp ) / 2 ;
2020-06-27 21:31:45 +00:00
2019-07-10 15:18:26 +00:00
if ( Abs ( axis ) > Abs ( dpad ) )
2019-06-13 00:35:26 +00:00
return axis ;
else
return dpad ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
case 3 :
{
return NewState . LeftStickY ;
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetAnalogueUpDown ( void )
2019-06-13 00:35:26 +00:00
{
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
{
2019-06-16 22:16:38 +00:00
int16 axis = NewState . LeftStickY ;
int16 dpad = ( NewState . DPadDown - NewState . DPadUp ) / 2 ;
2020-06-27 21:31:45 +00:00
2019-07-10 15:18:26 +00:00
if ( Abs ( axis ) > Abs ( dpad ) )
2019-06-13 00:35:26 +00:00
return axis ;
else
return dpad ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
case 3 :
{
return NewState . LeftStickY ;
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2020-10-07 21:21:44 +00:00
int16 CPad : : GetAnalogueLeftRight ( void )
{
switch ( CURMODE )
{
case 0 :
case 2 :
{
int16 axis = NewState . LeftStickX ;
int16 dpad = ( NewState . DPadRight - NewState . DPadLeft ) / 2 ;
if ( Abs ( axis ) > Abs ( dpad ) )
return axis ;
else
return dpad ;
break ;
}
case 1 :
case 3 :
{
return NewState . LeftStickX ;
break ;
}
}
return 0 ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetLookLeft ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return ! ! ( NewState . LeftShoulder2 & & ! NewState . RightShoulder2 ) ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetLookRight ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-05-29 16:06:33 +00:00
return false ;
2020-04-17 13:31:11 +00:00
2019-06-13 00:35:26 +00:00
return ! ! ( NewState . RightShoulder2 & & ! NewState . LeftShoulder2 ) ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetLookBehindForCar ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-04-17 13:31:11 +00:00
2019-06-13 00:35:26 +00:00
return ! ! ( NewState . RightShoulder2 & & NewState . LeftShoulder2 ) ;
2019-05-29 16:06:33 +00:00
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetLookBehindForPed ( void )
2019-05-29 16:06:33 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-05-29 16:06:33 +00:00
return false ;
2019-06-13 00:35:26 +00:00
2019-05-29 16:06:33 +00:00
return ! ! NewState . RightShock ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetHorn ( void )
2019-05-29 16:06:33 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-05-29 16:06:33 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
{
return ! ! NewState . LeftShock ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
{
return ! ! NewState . LeftShoulder1 ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! NewState . RightShoulder1 ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! NewState . LeftShock ;
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
2019-05-29 16:06:33 +00:00
}
2019-06-16 22:16:38 +00:00
bool CPad : : HornJustDown ( void )
2019-05-29 16:06:33 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-05-29 16:06:33 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
{
return ! ! ( NewState . LeftShock & & ! OldState . LeftShock ) ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
{
return ! ! ( NewState . LeftShoulder1 & & ! OldState . LeftShoulder1 ) ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! ( NewState . RightShoulder1 & & ! OldState . RightShoulder1 ) ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! ( NewState . LeftShock & & ! OldState . LeftShock ) ;
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
2019-05-15 14:52:37 +00:00
}
2019-06-13 00:35:26 +00:00
2019-06-16 22:16:38 +00:00
bool CPad : : GetCarGunFired ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 2 :
{
return ! ! NewState . Circle ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! NewState . RightShoulder1 ;
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : CarGunJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 2 :
{
return ! ! ( NewState . Circle & & ! OldState . Circle ) ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! ( NewState . RightShoulder1 & & ! OldState . RightShoulder1 ) ;
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetHandBrake ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
{
return NewState . RightShoulder1 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return NewState . Triangle ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return NewState . LeftShoulder1 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetBrake ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
{
return NewState . Square ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
{
return NewState . Square ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
2019-06-16 22:16:38 +00:00
int16 axis = 2 * NewState . RightStickY ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( axis < 0 )
return 0 ;
else
return axis ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetExitVehicle ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
2020-10-07 21:21:44 +00:00
if ( JustOutOfFrontend ! = 0 )
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 3 :
{
return ! ! NewState . Triangle ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! NewState . LeftShoulder1 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : ExitVehicleJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
2020-10-07 21:21:44 +00:00
if ( JustOutOfFrontend ! = 0 )
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 3 :
{
return ! ! ( NewState . Triangle & & ! OldState . Triangle ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! ( NewState . LeftShoulder1 & & ! OldState . LeftShoulder1 ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
int32 CPad : : GetWeapon ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
{
return NewState . Circle ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return NewState . Cross ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return NewState . RightShoulder1 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : WeaponJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
{
return ! ! ( NewState . Circle & & ! OldState . Circle ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! ( NewState . Cross & & ! OldState . Cross ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! ( NewState . RightShoulder1 & & ! OldState . RightShoulder1 ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : GetAccelerate ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return 0 ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
{
return NewState . Cross ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
{
return NewState . Cross ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
2019-06-16 22:16:38 +00:00
int16 axis = - 2 * NewState . RightStickY ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( axis < 0 )
return 0 ;
2020-06-27 21:31:45 +00:00
else
2019-06-13 00:35:26 +00:00
return axis ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2020-10-07 21:21:44 +00:00
bool CPad : : CycleCameraModeJustDown ( void )
{
bool result ;
switch ( CURMODE )
{
case 0 :
case 2 :
case 3 :
{
result = ! ! ( NewState . Select & & ! OldState . Select ) ;
break ;
}
case 1 :
{
result = ! ! ( NewState . DPadUp & & ! OldState . DPadUp ) ;
break ;
}
default :
{
result = false ;
break ;
}
}
if ( ! result )
{
switch ( CURMODE )
{
case 1 :
{
result = ! ! ( NewState . DPadDown & & ! OldState . DPadDown ) ;
break ;
}
default :
{
result = false ;
break ;
}
}
}
return result ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : CycleCameraModeUpJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
case 3 :
{
return ! ! ( NewState . Select & & ! OldState . Select ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
{
return ! ! ( NewState . DPadUp & & ! OldState . DPadUp ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : CycleCameraModeDownJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 2 :
case 3 :
{
return false ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
{
return ! ! ( NewState . DPadDown & & ! OldState . DPadDown ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : ChangeStationJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
{
return ! ! ( NewState . LeftShoulder1 & & ! OldState . LeftShoulder1 ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 1 :
{
return ! ! ( NewState . Select & & ! OldState . Select ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! ( NewState . LeftShock & & ! OldState . LeftShock ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! ( NewState . Circle & & ! OldState . Circle ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : CycleWeaponLeftJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return ! ! ( NewState . LeftShoulder2 & & ! OldState . LeftShoulder2 ) ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : CycleWeaponRightJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-04-17 13:31:11 +00:00
2019-06-13 00:35:26 +00:00
return ! ! ( NewState . RightShoulder2 & & ! OldState . RightShoulder2 ) ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetTarget ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 2 :
{
return ! ! NewState . RightShoulder1 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! NewState . LeftShoulder1 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : TargetJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 2 :
{
return ! ! ( NewState . RightShoulder1 & & ! OldState . RightShoulder1 ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! ( NewState . LeftShoulder1 & & ! OldState . LeftShoulder1 ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2020-07-30 12:11:06 +00:00
bool CPad : : CollectPickupJustDown ( void )
{
if ( ArePlayerControlsDisabled ( ) )
return false ;
switch ( CURMODE )
{
case 0 :
case 1 :
{
return ! ! ( NewState . LeftShoulder1 & & ! OldState . LeftShoulder1 ) ;
break ;
}
case 2 :
{
return ! ! ( NewState . Triangle & & ! OldState . Triangle ) ;
break ;
}
case 3 :
{
return ! ! ( NewState . Circle & & ! OldState . Circle ) ;
break ;
}
}
return false ;
}
2020-06-20 13:23:32 +00:00
bool CPad : : DuckJustDown ( void )
{
if ( ArePlayerControlsDisabled ( ) )
return false ;
return ! ! ( NewState . LeftShock & & ! OldState . LeftShock ) ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : JumpJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return ! ! ( NewState . Square & & ! OldState . Square ) ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetSprint ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 3 :
{
return ! ! NewState . Cross ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! NewState . Circle ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : ShiftTargetLeftJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-04-17 13:31:11 +00:00
2019-06-13 00:35:26 +00:00
return ! ! ( NewState . LeftShoulder2 & & ! OldState . LeftShoulder2 ) ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : ShiftTargetRightJustDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-04-17 13:31:11 +00:00
2020-10-07 21:21:44 +00:00
return ! ! ( NewState . LeftShoulder1 & & ! OldState . LeftShoulder1 ) | | ! ! ( NewState . RightShoulder2 & & ! OldState . RightShoulder2 ) ;
2019-06-13 00:35:26 +00:00
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetAnaloguePadUp ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
static int16 oldfStickY = 0 ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
int16 leftStickY = CPad : : GetPad ( 0 ) - > GetLeftStickY ( ) ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
if ( leftStickY < - 15 & & oldfStickY > = - 5 )
2019-06-13 00:35:26 +00:00
{
2020-10-07 21:21:44 +00:00
oldfStickY = leftStickY ;
2019-06-13 00:35:26 +00:00
return true ;
}
else
{
2020-10-07 21:21:44 +00:00
oldfStickY = leftStickY ;
2019-06-13 00:35:26 +00:00
return false ;
}
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetAnaloguePadDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
static int16 oldfStickY = 0 ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
int16 leftStickY = CPad : : GetPad ( 0 ) - > GetLeftStickY ( ) ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
if ( leftStickY > 15 & & oldfStickY < = 5 )
2019-06-13 00:35:26 +00:00
{
2020-10-07 21:21:44 +00:00
oldfStickY = leftStickY ;
2019-06-13 00:35:26 +00:00
return true ;
}
else
{
2020-10-07 21:21:44 +00:00
oldfStickY = leftStickY ;
2019-06-13 00:35:26 +00:00
return false ;
}
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetAnaloguePadLeft ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
static int16 oldfStickX = 0 ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
int16 leftStickX = CPad : : GetPad ( 0 ) - > GetLeftStickX ( ) ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
if ( leftStickX < - 15 & & oldfStickX > = - 5 )
2019-06-13 00:35:26 +00:00
{
2020-10-07 21:21:44 +00:00
oldfStickX = leftStickX ;
2019-06-13 00:35:26 +00:00
return true ;
}
else
{
2020-10-07 21:21:44 +00:00
oldfStickX = leftStickX ;
2019-06-13 00:35:26 +00:00
return false ;
}
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetAnaloguePadRight ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
static int16 oldfStickX = 0 ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
int16 leftStickX = CPad : : GetPad ( 0 ) - > GetLeftStickX ( ) ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
if ( leftStickX > 15 & & oldfStickX < = 5 )
2019-06-13 00:35:26 +00:00
{
2020-10-07 21:21:44 +00:00
oldfStickX = leftStickX ;
2019-06-13 00:35:26 +00:00
return true ;
}
else
{
2020-10-07 21:21:44 +00:00
oldfStickX = leftStickX ;
2019-06-13 00:35:26 +00:00
return false ;
}
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetAnaloguePadLeftJustUp ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
static int16 oldfStickX = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-16 22:16:38 +00:00
int16 X = GetPad ( 0 ) - > GetPedWalkLeftRight ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( X = = 0 & & oldfStickX < 0 )
{
2020-10-07 21:21:44 +00:00
oldfStickX = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return true ;
}
else
{
oldfStickX = X ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
}
2019-06-16 22:16:38 +00:00
bool CPad : : GetAnaloguePadRightJustUp ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
static int16 oldfStickX = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-16 22:16:38 +00:00
int16 X = GetPad ( 0 ) - > GetPedWalkLeftRight ( ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( X = = 0 & & oldfStickX > 0 )
{
2020-10-07 21:21:44 +00:00
oldfStickX = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return true ;
}
else
{
oldfStickX = X ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
}
2019-06-16 22:16:38 +00:00
bool CPad : : ForceCameraBehindPlayer ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
{
return ! ! NewState . LeftShoulder1 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! NewState . Triangle ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 3 :
{
return ! ! NewState . Circle ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : SniperZoomIn ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 3 :
{
return ! ! NewState . Square ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! NewState . Triangle ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2019-06-16 22:16:38 +00:00
bool CPad : : SniperZoomOut ( void )
2019-06-13 00:35:26 +00:00
{
2019-07-15 12:11:40 +00:00
if ( ArePlayerControlsDisabled ( ) )
2019-06-13 00:35:26 +00:00
return false ;
2020-05-02 21:11:02 +00:00
switch ( CURMODE )
2019-06-13 00:35:26 +00:00
{
case 0 :
case 1 :
case 3 :
{
return ! ! NewState . Cross ;
break ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
case 2 :
{
return ! ! NewState . Square ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
break ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return false ;
}
2020-05-02 21:11:02 +00:00
# undef CURMODE
2019-06-13 00:35:26 +00:00
2019-06-16 22:16:38 +00:00
int16 CPad : : SniperModeLookLeftRight ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
int16 axis = NewState . LeftStickX ;
int16 dpad = ( NewState . DPadRight - NewState . DPadLeft ) / 2 ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
if ( Abs ( axis ) > Abs ( dpad ) ) {
if ( Abs ( axis ) > 35.0f ) {
2020-10-08 18:46:00 +00:00
return ( axis > 0.f ? axis - 35.f : axis + 35.f ) * ( 128.f / ( 128 - 35 ) ) ;
2020-10-07 21:21:44 +00:00
} else {
return 0 ;
}
} else
2019-06-13 00:35:26 +00:00
return dpad ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : SniperModeLookUpDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
int16 axis = NewState . LeftStickY ;
2020-10-07 21:21:44 +00:00
int16 dpad ;
2020-06-27 21:31:45 +00:00
2020-11-05 14:38:41 +00:00
# ifdef FIX_BUGS
axis = - axis ;
# endif
2020-10-07 21:21:44 +00:00
if ( CPad : : bInvertLook4Pad ) {
axis = - axis ;
dpad = ( NewState . DPadDown - NewState . DPadUp ) / 2 ;
} else {
dpad = ( NewState . DPadUp - NewState . DPadDown ) / 2 ;
}
if ( Abs ( axis ) > Abs ( dpad ) ) {
if ( Abs ( axis ) > 35.0f ) {
2020-10-08 18:46:00 +00:00
return ( axis > 0.f ? axis - 35.f : axis + 35.f ) * ( 128.f / ( 128 - 35 ) ) ;
2020-10-07 21:21:44 +00:00
} else {
return 0 ;
}
} else
2019-06-13 00:35:26 +00:00
return dpad ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : LookAroundLeftRight ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
float axis = GetPad ( 0 ) - > NewState . RightStickX ;
2020-06-27 21:31:45 +00:00
2019-07-10 15:18:26 +00:00
if ( Abs ( axis ) > 85 & & ! GetLookBehindForPed ( ) )
2019-06-27 03:30:29 +00:00
return ( int16 ) ( ( axis + ( ( axis > 0 ) ? - 85 : 85 ) )
2019-06-13 00:35:26 +00:00
* ( 127.0f / 32.0f ) ) ; // 3.96875f
2019-07-10 15:18:26 +00:00
else if ( TheCamera . Cams [ 0 ] . Using3rdPersonMouseCam ( ) & & Abs ( axis ) > 10 )
2019-06-27 03:30:29 +00:00
return ( int16 ) ( ( axis + ( ( axis > 0 ) ? - 10 : 10 ) )
2019-06-13 00:35:26 +00:00
* ( 127.0f / 64.0f ) ) ; // 1.984375f
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return 0 ;
}
2019-06-16 22:16:38 +00:00
int16 CPad : : LookAroundUpDown ( void )
2019-06-13 00:35:26 +00:00
{
2019-06-16 22:16:38 +00:00
int16 axis = GetPad ( 0 ) - > NewState . RightStickY ;
2020-11-05 14:38:41 +00:00
# ifdef FIX_BUGS
axis = - axis ;
# endif
2020-10-07 21:21:44 +00:00
if ( CPad : : bInvertLook4Pad )
axis = - axis ;
2020-05-02 22:42:05 +00:00
2019-07-10 15:18:26 +00:00
if ( Abs ( axis ) > 85 & & ! GetLookBehindForPed ( ) )
2019-06-27 03:30:29 +00:00
return ( int16 ) ( ( axis + ( ( axis > 0 ) ? - 85 : 85 ) )
2019-06-13 00:35:26 +00:00
* ( 127.0f / 32.0f ) ) ; // 3.96875f
2019-07-10 15:18:26 +00:00
else if ( TheCamera . Cams [ 0 ] . Using3rdPersonMouseCam ( ) & & Abs ( axis ) > 40 )
2019-06-27 03:30:29 +00:00
return ( int16 ) ( ( axis + ( ( axis > 0 ) ? - 40 : 40 ) )
2019-06-13 00:35:26 +00:00
* ( 127.0f / 64.0f ) ) ; // 1.984375f
return 0 ;
}
void CPad : : ResetAverageWeapon ( void )
{
AverageWeapon = GetWeapon ( ) ;
AverageEntries = 1 ;
}
void CPad : : PrintErrorMessage ( void )
{
2020-10-07 21:21:44 +00:00
if ( TheCamera . m_WideScreenOn )
return ;
2019-06-13 00:35:26 +00:00
if ( bDisplayNoControllerMessage & & ! CGame : : playingIntro & & ! FrontEndMenuManager . m_bMenuActive )
{
2020-09-26 23:36:49 +00:00
CSprite2d : : DrawRect ( CRect ( SCREEN_STRETCH_X ( 20.0f ) , SCREEN_SCALE_FROM_BOTTOM ( 130.0f ) , SCREEN_STRETCH_FROM_RIGHT ( 20.0f ) , SCREEN_SCALE_Y ( 140.0f ) ) , CRGBA ( 50 , 50 , 50 , 210 ) ) ;
2020-12-19 18:25:45 +00:00
# ifdef FIX_BUGS
2020-09-26 23:36:49 +00:00
CFont : : SetScale ( SCREEN_SCALE_X ( 0.85f ) , SCREEN_SCALE_Y ( 1.0f ) ) ;
2020-12-19 18:25:45 +00:00
# else
2019-06-13 00:35:26 +00:00
CFont : : SetScale ( 0.85f , 1.0f ) ;
2020-12-19 18:25:45 +00:00
# endif
2019-06-13 00:35:26 +00:00
CFont : : SetJustifyOff ( ) ;
CFont : : SetBackgroundOff ( ) ;
2020-12-19 18:25:45 +00:00
# ifdef FIX_BUGS
CFont : : SetCentreSize ( SCREEN_SCALE_X ( DEFAULT_SCREEN_WIDTH - 20 ) ) ;
# else
CFont : : SetCentreSize ( SCREEN_WIDTH - 20 ) ;
# endif
2019-06-13 00:35:26 +00:00
CFont : : SetCentreOn ( ) ;
CFont : : SetPropOn ( ) ;
CFont : : SetColor ( CRGBA ( 255 , 255 , 200 , 200 ) ) ;
2020-06-07 01:10:06 +00:00
CFont : : SetFontStyle ( FONT_STANDARD ) ;
2019-06-13 00:35:26 +00:00
CFont : : PrintString
(
SCREEN_WIDTH / 2 ,
2020-09-26 23:36:49 +00:00
SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y ( 40.0f ) ,
2019-06-13 00:35:26 +00:00
TheText . Get ( " NOCONT " ) // Please reconnect an analog controller (DUALSHOCK@) or analog controller (DUALSHOCK@2). to controller port 1 to continue
) ;
}
else if ( bObsoleteControllerMessage )
{
2020-09-26 23:36:49 +00:00
CSprite2d : : DrawRect ( CRect ( SCREEN_STRETCH_X ( 20.0f ) , SCREEN_SCALE_FROM_BOTTOM ( 130.0f ) , SCREEN_STRETCH_FROM_RIGHT ( 20.0f ) , SCREEN_SCALE_Y ( 140.0f ) ) , CRGBA ( 50 , 50 , 50 , 210 ) ) ;
2020-12-19 18:25:45 +00:00
# ifdef FIX_BUGS
2020-09-26 23:36:49 +00:00
CFont : : SetScale ( SCREEN_SCALE_X ( 0.85f ) , SCREEN_SCALE_Y ( 1.0f ) ) ;
2020-12-19 18:25:45 +00:00
# else
2019-06-13 00:35:26 +00:00
CFont : : SetScale ( 0.85f , 1.0f ) ;
2020-12-19 18:25:45 +00:00
# endif
2019-06-13 00:35:26 +00:00
CFont : : SetJustifyOff ( ) ;
CFont : : SetBackgroundOff ( ) ;
2020-12-19 18:25:45 +00:00
# ifdef FIX_BUGS
CFont : : SetCentreSize ( SCREEN_SCALE_X ( DEFAULT_SCREEN_WIDTH - 20 ) ) ;
# else
CFont : : SetCentreSize ( SCREEN_WIDTH - 20 ) ;
# endif
2019-06-13 00:35:26 +00:00
CFont : : SetCentreOn ( ) ;
CFont : : SetPropOn ( ) ;
CFont : : SetColor ( CRGBA ( 255 , 255 , 200 , 200 ) ) ;
2020-06-07 01:10:06 +00:00
CFont : : SetFontStyle ( FONT_STANDARD ) ;
2019-06-13 00:35:26 +00:00
CFont : : PrintString
(
SCREEN_WIDTH / 2 ,
2020-09-26 23:36:49 +00:00
SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y ( 40.0f ) ,
2019-06-13 00:35:26 +00:00
TheText . Get ( " WRCONT " ) // The controller connected to controller port 1 is an unsupported controller. Grand Theft Auto III requires an analog controller (DUALSHOCK@) or analog controller (DUALSHOCK@2).
) ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
}
void LittleTest ( void )
{
2019-06-16 22:16:38 +00:00
static int32 Cunt = 0 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
Cunt + + ; // ???
}
void CPad : : ResetCheats ( void )
{
CWeather : : ReleaseWeather ( ) ;
2020-06-27 21:31:45 +00:00
2020-10-07 21:21:44 +00:00
gbFastTime = false ;
2019-06-13 00:35:26 +00:00
CPopulation : : ms_bGivePedsWeapons = false ;
2020-10-07 21:21:44 +00:00
CTimer : : SetTimeScale ( 1.0f ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
CVehicle : : bWheelsOnlyCheat = false ;
CVehicle : : bAllDodosCheat = false ;
CVehicle : : bCheat3 = false ;
CVehicle : : bCheat4 = false ;
CVehicle : : bCheat5 = false ;
2020-10-07 21:21:44 +00:00
CVehicle : : bAllTaxisHaveNitro = false ;
CVehicle : : bHoverCheat = false ;
2020-06-14 12:57:27 +00:00
CVehicle : : bCheat8 = false ;
2020-10-07 21:21:44 +00:00
CVehicle : : bCheat9 = false ;
CVehicle : : bCheat10 = false ;
2020-09-30 23:20:09 +00:00
# ifdef RESTORE_ALLCARSHELI_CHEAT
bAllCarCheat = false ;
# endif
2020-05-10 16:14:14 +00:00
gbBlackCars = false ;
gbPinkCars = false ;
2020-10-07 21:21:44 +00:00
2020-08-16 15:39:11 +00:00
CCarCtrl : : bMadDriversCheat = false ;
2020-08-30 20:47:12 +00:00
CTrafficLights : : bGreenLightsCheat = false ;
CStats : : ShowChaseStatOnScreen = 0 ;
2020-10-07 21:21:44 +00:00
CPed : : bNastyLimbsCheat = false ;
CPed : : bFannyMagnetCheat = false ;
CPed : : bPedCheat3 = false ;
2019-06-13 00:35:26 +00:00
}
2019-06-16 22:16:38 +00:00
char * CPad : : EditString ( char * pStr , int32 nSize )
2019-06-13 00:35:26 +00:00
{
2020-07-22 11:56:28 +00:00
int32 pos = ( int32 ) strlen ( pStr ) ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
// letters
2019-06-16 22:16:38 +00:00
for ( int32 i = 0 ; i < ( ' Z ' - ' A ' + 1 ) ; i + + )
2019-06-13 00:35:26 +00:00
{
if ( GetPad ( 0 ) - > GetCharJustDown ( i + ' A ' ) & & pos < nSize - 1 )
{
pStr [ pos + + ] = i + ' A ' ;
pStr [ pos ] = ' \0 ' ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetCharJustDown ( i + ' a ' ) & & pos < nSize - 1 )
{
pStr [ pos + + ] = i + ' a ' ;
pStr [ pos ] = ' \0 ' ;
}
}
2020-06-27 21:31:45 +00:00
// numbers
2019-07-20 12:39:38 +00:00
for ( int32 i = 0 ; i < ( ' 9 ' - ' 0 ' + 1 ) ; i + + )
2019-06-13 00:35:26 +00:00
{
if ( GetPad ( 0 ) - > GetCharJustDown ( i + ' 0 ' ) & & pos < nSize - 1 )
{
pStr [ pos + + ] = i + ' 0 ' ;
pStr [ pos ] = ' \0 ' ;
}
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
// space
if ( GetPad ( 0 ) - > GetCharJustDown ( ' ' ) & & pos < nSize - 1 )
{
pStr [ pos + + ] = ' ' ;
pStr [ pos ] = ' \0 ' ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
// del
if ( GetPad ( 0 ) - > GetDeleteJustDown ( ) | | GetPad ( 0 ) - > GetBackspaceJustDown ( ) )
{
if ( pos > 0 )
pStr [ pos - 1 ] = ' \0 ' ;
}
// extenter/up/down
2019-10-29 15:21:02 +00:00
if ( GetPad ( 0 ) - > GetReturnJustDown ( ) | | GetPad ( 0 ) - > GetUpJustDown ( ) | | GetPad ( 0 ) - > GetDownJustDown ( ) )
2019-06-30 10:53:39 +00:00
return nil ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return pStr ;
}
2019-06-16 22:16:38 +00:00
int32 * CPad : : EditCodesForControls ( int32 * pRsKeys , int32 nSize )
2019-06-13 00:35:26 +00:00
{
* pRsKeys = rsNULL ;
2019-06-16 22:16:38 +00:00
for ( int32 i = 0 ; i < 255 ; i + + )
2019-06-13 00:35:26 +00:00
{
if ( GetPad ( 0 ) - > GetCharJustDown ( i ) )
* pRsKeys = i ;
}
2020-06-27 21:31:45 +00:00
2019-06-16 23:32:34 +00:00
for ( int32 i = 0 ; i < 12 ; i + + )
2019-06-13 00:35:26 +00:00
{
if ( GetPad ( 0 ) - > GetFJustDown ( i ) )
* pRsKeys = i + rsF1 ;
}
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetEscapeJustDown ( ) )
* pRsKeys = rsESC ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetInsertJustDown ( ) )
* pRsKeys = rsINS ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetDeleteJustDown ( ) )
* pRsKeys = rsDEL ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetHomeJustDown ( ) )
* pRsKeys = rsHOME ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetEndJustDown ( ) )
* pRsKeys = rsEND ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPageUpJustDown ( ) )
* pRsKeys = rsPGUP ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPageDownJustDown ( ) )
* pRsKeys = rsPGDN ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetUpJustDown ( ) )
* pRsKeys = rsUP ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetDownJustDown ( ) )
* pRsKeys = rsDOWN ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetLeftJustDown ( ) )
* pRsKeys = rsLEFT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetRightJustDown ( ) )
* pRsKeys = rsRIGHT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetScrollLockJustDown ( ) )
* pRsKeys = rsSCROLL ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPauseJustDown ( ) )
* pRsKeys = rsPAUSE ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetNumLockJustDown ( ) )
* pRsKeys = rsNUMLOCK ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetDivideJustDown ( ) )
* pRsKeys = rsDIVIDE ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetTimesJustDown ( ) )
* pRsKeys = rsTIMES ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetMinusJustDown ( ) )
* pRsKeys = rsMINUS ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPlusJustDown ( ) )
* pRsKeys = rsPLUS ;
if ( GetPad ( 0 ) - > GetPadEnterJustDown ( ) )
* pRsKeys = rsPADENTER ;
if ( GetPad ( 0 ) - > GetPadDelJustDown ( ) )
* pRsKeys = rsPADDEL ;
if ( GetPad ( 0 ) - > GetPad1JustDown ( ) )
* pRsKeys = rsPADEND ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad2JustDown ( ) )
* pRsKeys = rsPADDOWN ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad3JustDown ( ) )
* pRsKeys = rsPADPGDN ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad4JustDown ( ) )
* pRsKeys = rsPADLEFT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad5JustDown ( ) )
* pRsKeys = rsPAD5 ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad6JustDown ( ) )
* pRsKeys = rsPADRIGHT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad7JustDown ( ) )
* pRsKeys = rsPADHOME ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad8JustDown ( ) )
* pRsKeys = rsPADUP ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad9JustDown ( ) )
* pRsKeys = rsPADPGUP ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetPad0JustDown ( ) )
* pRsKeys = rsPADINS ;
if ( GetPad ( 0 ) - > GetBackspaceJustDown ( ) )
* pRsKeys = rsBACKSP ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetTabJustDown ( ) )
* pRsKeys = rsTAB ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetCapsLockJustDown ( ) )
* pRsKeys = rsCAPSLK ;
2020-06-27 21:31:45 +00:00
2019-10-29 15:21:02 +00:00
if ( GetPad ( 0 ) - > GetReturnJustDown ( ) )
2019-06-13 00:35:26 +00:00
* pRsKeys = rsENTER ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetLeftShiftJustDown ( ) )
* pRsKeys = rsLSHIFT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetShiftJustDown ( ) )
* pRsKeys = rsSHIFT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetRightShiftJustDown ( ) )
* pRsKeys = rsRSHIFT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetLeftCtrlJustDown ( ) )
* pRsKeys = rsLCTRL ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetRightCtrlJustDown ( ) )
* pRsKeys = rsRCTRL ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetLeftAltJustDown ( ) )
* pRsKeys = rsLALT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetRightAltJustDown ( ) )
* pRsKeys = rsRALT ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetLeftWinJustDown ( ) )
* pRsKeys = rsLWIN ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetRightWinJustDown ( ) )
* pRsKeys = rsRWIN ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
if ( GetPad ( 0 ) - > GetAppsJustDown ( ) )
* pRsKeys = rsAPPS ;
2020-06-27 21:31:45 +00:00
2019-06-13 00:35:26 +00:00
return pRsKeys ;
}
2020-10-07 21:21:44 +00:00
void CPad : : FixPadsAfterSave ( void )
{
UpdatePads ( ) ;
if ( bObsoleteControllerMessage )
{
bObsoleteControllerMessage = false ;
GetPad ( 0 ) - > Phase = 0 ;
}
2020-10-08 18:46:00 +00:00
}