mirror of
https://github.com/mrxenginner/reVC.git
synced 2026-10-10 20:03:05 +08:00
ps2 CPad; wrapped lots of things in GTA_PC_CONTROLS
This commit is contained in:
@@ -541,9 +541,12 @@ CCutsceneMgr::Update(void)
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
||||
if (CPad::GetPad(0)->GetCrossJustDown()
|
||||
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|
||||
|| CPad::GetPad(0)->GetEnterJustDown()
|
||||
|| CPad::GetPad(0)->GetCharJustDown(' '))
|
||||
|| CPad::GetPad(0)->GetCharJustDown(' ')
|
||||
#endif
|
||||
)
|
||||
FinishCutscene();
|
||||
}
|
||||
}
|
||||
|
||||
+60
-14
@@ -1342,6 +1342,7 @@ int16 nFadeControlThreshhold = 45;
|
||||
float fDefaultAlphaOrient = -0.22f;
|
||||
float fMouseAvoidGeomReturnRate = 0.92f;
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
void
|
||||
CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float)
|
||||
{
|
||||
@@ -1535,6 +1536,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
|
||||
TheCamera.pTargetEntity->GetMatrix().UpdateRW();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
float fBillsBetaOffset; // made up name, actually in CCam
|
||||
|
||||
@@ -2240,22 +2242,28 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float)
|
||||
Source.y -= BackOffset*Sin(m_fInitialPlayerOrientation);
|
||||
|
||||
// Look around
|
||||
float LookLeftRight, LookUpDown;
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
bool UseMouse = false;
|
||||
float MouseX = CPad::GetPad(0)->GetMouseX();
|
||||
float MouseY = CPad::GetPad(0)->GetMouseY();
|
||||
float LookLeftRight, LookUpDown;
|
||||
if(MouseX != 0.0f || MouseY != 0.0f){
|
||||
UseMouse = true;
|
||||
LookLeftRight = -3.0f*MouseX;
|
||||
LookUpDown = 4.0f*MouseY;
|
||||
}else{
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
LookLeftRight = -CPad::GetPad(0)->SniperModeLookLeftRight();
|
||||
LookUpDown = CPad::GetPad(0)->SniperModeLookUpDown();
|
||||
}
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(UseMouse){
|
||||
Beta += TheCamera.m_fMouseAccelHorzntl * LookLeftRight * FOV/80.0f;
|
||||
Alpha += TheCamera.m_fMouseAccelVertical * LookUpDown * FOV/80.0f;
|
||||
}else{
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
|
||||
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
|
||||
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
|
||||
@@ -2342,22 +2350,28 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
|
||||
}
|
||||
|
||||
// Look around
|
||||
float LookLeftRight, LookUpDown;
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
bool UseMouse = false;
|
||||
float MouseX = CPad::GetPad(0)->GetMouseX();
|
||||
float MouseY = CPad::GetPad(0)->GetMouseY();
|
||||
float LookLeftRight, LookUpDown;
|
||||
if(MouseX != 0.0f || MouseY != 0.0f){
|
||||
UseMouse = true;
|
||||
LookLeftRight = -3.0f*MouseX;
|
||||
LookUpDown = 4.0f*MouseY;
|
||||
}else{
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
LookLeftRight = -CPad::GetPad(0)->SniperModeLookLeftRight();
|
||||
LookUpDown = CPad::GetPad(0)->SniperModeLookUpDown();
|
||||
}
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(UseMouse){
|
||||
Beta += TheCamera.m_fMouseAccelHorzntl * LookLeftRight * FOV/80.0f;
|
||||
Alpha += TheCamera.m_fMouseAccelVertical * LookUpDown * FOV/80.0f;
|
||||
}else if(Mode == MODE_HELICANNON_1STPERSON){
|
||||
}else
|
||||
#endif
|
||||
if(Mode == MODE_HELICANNON_1STPERSON){
|
||||
LookLeftRight /= 128.0f;
|
||||
LookUpDown /= 128.0f;
|
||||
Beta += LookLeftRight*Abs(LookLeftRight)*0.56f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
|
||||
@@ -2753,22 +2767,28 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
|
||||
// Source - MidPos;
|
||||
|
||||
// Look around
|
||||
float LookLeftRight, LookUpDown;
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
bool UseMouse = false;
|
||||
float MouseX = CPad::GetPad(0)->GetMouseX();
|
||||
float MouseY = CPad::GetPad(0)->GetMouseY();
|
||||
float LookLeftRight, LookUpDown;
|
||||
if(MouseX != 0.0f || MouseY != 0.0f){
|
||||
UseMouse = true;
|
||||
LookLeftRight = -3.0f*MouseX;
|
||||
LookUpDown = 4.0f*MouseY;
|
||||
}else{
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
LookLeftRight = -CPad::GetPad(0)->LookAroundLeftRight();
|
||||
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
|
||||
}
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(UseMouse){
|
||||
Beta += TheCamera.m_fMouseAccelHorzntl * LookLeftRight * FOV/80.0f;
|
||||
Alpha += TheCamera.m_fMouseAccelVertical * LookUpDown * FOV/80.0f;
|
||||
}else{
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
|
||||
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
|
||||
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
|
||||
@@ -2892,22 +2912,28 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
|
||||
}
|
||||
|
||||
// Look around
|
||||
float LookLeftRight, LookUpDown;
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
bool UseMouse = false;
|
||||
float MouseX = CPad::GetPad(0)->GetMouseX();
|
||||
float MouseY = CPad::GetPad(0)->GetMouseY();
|
||||
float LookLeftRight, LookUpDown;
|
||||
if(MouseX != 0.0f || MouseY != 0.0f){
|
||||
UseMouse = true;
|
||||
LookLeftRight = -3.0f*MouseX;
|
||||
LookUpDown = 4.0f*MouseY;
|
||||
}else{
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
LookLeftRight = -CPad::GetPad(0)->SniperModeLookLeftRight();
|
||||
LookUpDown = CPad::GetPad(0)->SniperModeLookUpDown();
|
||||
}
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(UseMouse){
|
||||
Beta += TheCamera.m_fMouseAccelHorzntl * LookLeftRight * FOV/80.0f;
|
||||
Alpha += TheCamera.m_fMouseAccelVertical * LookUpDown * FOV/80.0f;
|
||||
}else{
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
|
||||
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
|
||||
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
|
||||
@@ -2922,6 +2948,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
|
||||
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
|
||||
TargetCoors.z = 3.0f * Sin(Alpha) + Source.z;
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
UseMouse = false;
|
||||
int ZoomInButton = ControlsManager.GetMouseButtonAssociatedWithAction(PED_SNIPER_ZOOM_IN);
|
||||
int ZoomOutButton = ControlsManager.GetMouseButtonAssociatedWithAction(PED_SNIPER_ZOOM_OUT);
|
||||
@@ -2938,6 +2965,9 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
|
||||
}
|
||||
}
|
||||
if((CPad::GetPad(0)->SniperZoomIn() || CPad::GetPad(0)->SniperZoomOut()) && !UseMouse){
|
||||
#else
|
||||
if((CPad::GetPad(0)->SniperZoomIn() || CPad::GetPad(0)->SniperZoomOut())){
|
||||
#endif
|
||||
if(CPad::GetPad(0)->SniperZoomOut()){
|
||||
FOV *= (255.0f*CTimer::GetTimeStep() + 10000.0f) / 10000.0f;
|
||||
TargetFOV = FOV;
|
||||
@@ -3992,10 +4022,17 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
||||
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
|
||||
else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
|
||||
Speed += 0.1f;
|
||||
else if(CPad::GetPad(1)->GetCross() || CPad::GetPad(1)->GetRightMouse())
|
||||
Speed -= 0.1f;
|
||||
#else
|
||||
if(CPad::GetPad(1)->GetSquare())
|
||||
Speed += 0.1f;
|
||||
else if(CPad::GetPad(1)->GetCross())
|
||||
Speed -= 0.1f;
|
||||
#endif
|
||||
else
|
||||
Speed = 0.0f;
|
||||
if(Speed > 70.0f) Speed = 70.0f;
|
||||
@@ -4072,10 +4109,17 @@ CCam::Process_Editor(const CVector&, float, float, float)
|
||||
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
|
||||
else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
|
||||
Speed += 0.1f;
|
||||
else if(CPad::GetPad(1)->GetCross() || CPad::GetPad(1)->GetRightMouse())
|
||||
Speed -= 0.1f;
|
||||
#else
|
||||
if(CPad::GetPad(1)->GetSquare())
|
||||
Speed += 0.1f;
|
||||
else if(CPad::GetPad(1)->GetCross())
|
||||
Speed -= 0.1f;
|
||||
#endif
|
||||
else
|
||||
Speed = 0.0f;
|
||||
if(Speed > 70.0f) Speed = 70.0f;
|
||||
@@ -4629,11 +4673,11 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
|
||||
while(Alpha < -PI) Alpha += 2.0f*PI;
|
||||
|
||||
// Look around
|
||||
float LookLeftRight, LookUpDown;
|
||||
bool UseMouse = false;
|
||||
/*
|
||||
float MouseX = CPad::GetPad(0)->GetMouseX();
|
||||
float MouseY = CPad::GetPad(0)->GetMouseY();
|
||||
float LookLeftRight, LookUpDown;
|
||||
/*
|
||||
if((MouseX != 0.0f || MouseY != 0.0f) && !CPad::GetPad(0)->ArePlayerControlsDisabled()){
|
||||
UseMouse = true;
|
||||
LookLeftRight = -2.5f*MouseX;
|
||||
@@ -5102,6 +5146,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
|
||||
bool mouseChangesBeta = false;
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
// FIX: Disable mouse movement in drive-by, it's buggy. Original SA bug.
|
||||
if (/*bFreeMouseCam &&*/ CCamera::m_bUseMouse3rdPerson && !pad->ArePlayerControlsDisabled() && nextDirectionIsForward) {
|
||||
float mouseY = pad->GetMouseY() * 2.0f;
|
||||
@@ -5129,6 +5174,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
mouseChangesBeta = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (correctAlpha) {
|
||||
if (nPreviousMode != MODE_CAM_ON_A_STRING)
|
||||
|
||||
@@ -986,23 +986,27 @@ CCamera::CamControl(void)
|
||||
if(CPad::GetPad(0)->CycleCameraModeUpJustDown() && !CReplay::IsPlayingBack() &&
|
||||
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
|
||||
!m_WideScreenOn && !m_bFailedCullZoneTestPreviously && !m_bFirstPersonBeingUsed){
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(FrontEndMenuManager.m_ControlMethod == CONTROL_STANDARD){
|
||||
if(PedZoomIndicator == CAM_ZOOM_3)
|
||||
PedZoomIndicator = CAM_ZOOM_1;
|
||||
else
|
||||
PedZoomIndicator = CAM_ZOOM_3;
|
||||
}else
|
||||
#endif
|
||||
PedZoomIndicator--;
|
||||
}
|
||||
if(CPad::GetPad(0)->CycleCameraModeDownJustDown() && !CReplay::IsPlayingBack() &&
|
||||
(m_bLookingAtPlayer || WhoIsInControlOfTheCamera == CAMCONTROL_OBBE) &&
|
||||
!m_WideScreenOn && !m_bFailedCullZoneTestPreviously && !m_bFirstPersonBeingUsed){
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(FrontEndMenuManager.m_ControlMethod == CONTROL_STANDARD){
|
||||
if(PedZoomIndicator == CAM_ZOOM_3)
|
||||
PedZoomIndicator = CAM_ZOOM_1;
|
||||
else
|
||||
PedZoomIndicator = CAM_ZOOM_3;
|
||||
}else
|
||||
#endif
|
||||
PedZoomIndicator++;
|
||||
}
|
||||
// disabled top down and obbe's cam here
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
#include "Camera.h"
|
||||
#include "GenericGameStorage.h"
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
|
||||
CControllerConfigManager ControlsManager;
|
||||
|
||||
CControllerConfigManager::CControllerConfigManager()
|
||||
@@ -2916,3 +2918,5 @@ void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef __GTA_CONTROLLERCONFIG_H__
|
||||
#define __GTA_CONTROLLERCONFIG_H__
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
@@ -229,4 +231,6 @@ VALIDATE_SIZE(CControllerConfigManager, 0x143C);
|
||||
|
||||
extern CControllerConfigManager ControlsManager;
|
||||
|
||||
#endif
|
||||
|
||||
#endif // __GTA_CONTROLLERCONFIG_H__
|
||||
|
||||
+104
-40
@@ -53,7 +53,9 @@ u_long128 pad_dma_buf[scePadDmaBufferMax] __attribute__((aligned(64)));
|
||||
u_long128 pad2_dma_buf[scePadDmaBufferMax] __attribute__((aligned(64)));
|
||||
#endif
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
CMousePointerStateHelper MousePointerStateHelper;
|
||||
#endif
|
||||
|
||||
bool CPad::bDisplayNoControllerMessage;
|
||||
bool CPad::bObsoleteControllerMessage;
|
||||
@@ -67,6 +69,7 @@ unsigned char act_direct[6];
|
||||
unsigned char act_align[6];
|
||||
#endif
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
CKeyboardState CPad::OldKeyState;
|
||||
CKeyboardState CPad::NewKeyState;
|
||||
CKeyboardState CPad::TempKeyState;
|
||||
@@ -76,6 +79,7 @@ char CPad::KeyBoardCheatString[30];
|
||||
CMouseControllerState CPad::OldMouseControllerState;
|
||||
CMouseControllerState CPad::NewMouseControllerState;
|
||||
CMouseControllerState CPad::PCTempMouseControllerState;
|
||||
#endif
|
||||
|
||||
#ifdef DETECT_PAD_INPUT_SWITCH
|
||||
bool CPad::IsAffectedByController = false;
|
||||
@@ -740,6 +744,7 @@ void CPad::Clear(bool bResetPlayerControls)
|
||||
NewState.Clear();
|
||||
OldState.Clear();
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
PCTempKeyState.Clear();
|
||||
PCTempJoyState.Clear();
|
||||
PCTempMouseState.Clear();
|
||||
@@ -751,6 +756,7 @@ void CPad::Clear(bool bResetPlayerControls)
|
||||
NewMouseControllerState.Clear();
|
||||
OldMouseControllerState.Clear();
|
||||
PCTempMouseControllerState.Clear();
|
||||
#endif
|
||||
|
||||
Phase = 0;
|
||||
ShakeFreq = 0;
|
||||
@@ -785,6 +791,7 @@ uint32 CPad::InputHowLongAgo()
|
||||
return CTimer::GetTimeInMilliseconds() - LastTimeTouched;
|
||||
}
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
void CPad::ClearMouseHistory()
|
||||
{
|
||||
PCTempMouseControllerState.Clear();
|
||||
@@ -1026,6 +1033,7 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
|
||||
#undef _FIX_AXIS_DIR
|
||||
#undef _FIX_RECON_DIR
|
||||
}
|
||||
#endif
|
||||
|
||||
void CPad::StartShake(int16 nDur, uint8 nFreq)
|
||||
{
|
||||
@@ -1246,6 +1254,7 @@ int Cheat_strncmp(char* sourceStr, char* origCheatStr)
|
||||
#undef ccmp
|
||||
}
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
// TODO(Miami): Mobile has changed some of the cheats to include debugging things
|
||||
void CPad::AddToPCCheatString(char c)
|
||||
{
|
||||
@@ -1583,6 +1592,7 @@ void CPad::AddToPCCheatString(char c)
|
||||
|
||||
#undef _CHEATCMP
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XINPUT
|
||||
int CPad::XInputJoy1 = 0;
|
||||
@@ -1654,6 +1664,15 @@ void CPad::AffectFromXinput(uint32 pad)
|
||||
|
||||
void CPad::UpdatePads(void)
|
||||
{
|
||||
#ifndef GTA_PC_CONTROLS
|
||||
Pads[0].Update(0);
|
||||
#ifndef MASTER
|
||||
Pads[1].Update(1);
|
||||
#else
|
||||
Pads[1].NewState.Clear();
|
||||
Pads[1].OldState.Clear();
|
||||
#endif
|
||||
#else
|
||||
bool bUpdate = true;
|
||||
|
||||
GetPad(0)->UpdateMouse();
|
||||
@@ -1703,6 +1722,7 @@ void CPad::UpdatePads(void)
|
||||
OldKeyState = NewKeyState;
|
||||
NewKeyState = TempKeyState;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void CPad::ProcessPCSpecificStuff(void)
|
||||
@@ -1715,12 +1735,14 @@ void CPad::Update(int16 pad)
|
||||
OldState = NewState;
|
||||
|
||||
#ifdef GTA_PS2
|
||||
bObsoleteControllerMessage = false;
|
||||
if(pad != 0)
|
||||
bObsoleteControllerMessage = false;
|
||||
|
||||
//int iPressureBtn;
|
||||
int id;
|
||||
int ext_id=0;
|
||||
int state;
|
||||
int i;
|
||||
int16 id;
|
||||
int16 ext_id=0;
|
||||
int16 state;
|
||||
int rterm_id = 0;
|
||||
unsigned short paddata, tpad;
|
||||
unsigned char rdata[32];
|
||||
@@ -1800,7 +1822,7 @@ void CPad::Update(int16 pad)
|
||||
if (scePadGetReqState(pad, 0)==scePadReqStateComplete)
|
||||
{
|
||||
// Lock mode complete
|
||||
Phase=0; // Accept normal dualshock
|
||||
Phase=70; // Accept normal dualshock
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1834,15 +1856,14 @@ void CPad::Update(int16 pad)
|
||||
|
||||
act_align[0] = 0; // Offset 0 for motor0
|
||||
act_align[1] = 1; // Offset 1 for motor1
|
||||
|
||||
act_align[2] = 0xff;
|
||||
act_align[3] = 0xff;
|
||||
act_align[4] = 0xff;
|
||||
act_align[5] = 0xff;
|
||||
act_align[0] = 0; // Offset 0 for motor0
|
||||
act_align[1] = 1; // Offset 1 for motor1
|
||||
for(i = 2; i < 6; i++)
|
||||
act_align[i] = 0xff;
|
||||
|
||||
// Asynchronous function
|
||||
if (scePadSetActAlign(pad, 0, act_align)==0) break;
|
||||
Phase++;
|
||||
if (scePadSetActAlign(pad, 0, act_align))
|
||||
Phase++;
|
||||
break;
|
||||
|
||||
|
||||
@@ -1892,46 +1913,85 @@ void CPad::Update(int16 pad)
|
||||
{
|
||||
if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(pad))
|
||||
{
|
||||
tpad = paddata;
|
||||
|
||||
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];
|
||||
|
||||
#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)
|
||||
|
||||
NewState.RightStickX = FIX_AXIS(NewState.RightStickX);
|
||||
NewState.RightStickY = FIX_AXIS(NewState.RightStickY);
|
||||
NewState.LeftStickX = FIX_AXIS(NewState.LeftStickX);
|
||||
NewState.LeftStickY = FIX_AXIS(NewState.LeftStickY);
|
||||
tpad = paddata;
|
||||
|
||||
if((rterm_id&0xF) == 9){
|
||||
NewState.DPadUp = rdata[10];
|
||||
NewState.DPadUp = Min(NewState.DPadUp*4, 255);
|
||||
NewState.DPadDown = rdata[11];
|
||||
NewState.DPadDown = Min(NewState.DPadDown*4, 255);
|
||||
NewState.DPadLeft = rdata[9];
|
||||
NewState.DPadLeft = Min(NewState.DPadLeft*4, 255);
|
||||
NewState.DPadRight = rdata[8];
|
||||
NewState.DPadRight = Min(NewState.DPadRight*4, 255);
|
||||
NewState.Triangle = rdata[12];
|
||||
NewState.Triangle = Min(NewState.Triangle*4, 255);
|
||||
NewState.Cross = rdata[14];
|
||||
NewState.Cross = Min(NewState.Cross*4, 255);
|
||||
NewState.Square = rdata[15];
|
||||
NewState.Square = Min(NewState.Square*4, 255);
|
||||
NewState.Circle = rdata[13];
|
||||
NewState.Circle = Min(NewState.Circle*4, 255);
|
||||
NewState.Start = ( tpad & SCE_PADstart ) ? 255 : 0;
|
||||
NewState.Select = ( tpad & SCE_PADselect ) ? 255 : 0;
|
||||
NewState.LeftShoulder1 = rdata[16];
|
||||
NewState.LeftShoulder1 = Min(NewState.LeftShoulder1*4, 255);
|
||||
NewState.LeftShoulder2 = rdata[18];
|
||||
NewState.LeftShoulder2 = Min(NewState.LeftShoulder2*4, 255);
|
||||
NewState.RightShoulder1 = rdata[17];
|
||||
NewState.RightShoulder1 = Min(NewState.RightShoulder1*4, 255);
|
||||
NewState.RightShoulder2 = rdata[19];
|
||||
NewState.RightShoulder2 = Min(NewState.RightShoulder2*4, 255);
|
||||
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];
|
||||
|
||||
NewState.RightStickX = FIX_AXIS(NewState.RightStickX);
|
||||
NewState.RightStickY = FIX_AXIS(NewState.RightStickY);
|
||||
NewState.LeftStickX = FIX_AXIS(NewState.LeftStickX);
|
||||
NewState.LeftStickY = FIX_AXIS(NewState.LeftStickY);
|
||||
}else{
|
||||
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];
|
||||
|
||||
NewState.RightStickX = FIX_AXIS(NewState.RightStickX);
|
||||
NewState.RightStickY = FIX_AXIS(NewState.RightStickY);
|
||||
NewState.LeftStickX = FIX_AXIS(NewState.LeftStickX);
|
||||
NewState.LeftStickY = FIX_AXIS(NewState.LeftStickY);
|
||||
}
|
||||
#undef FIX_AXIS
|
||||
#undef CLAMP_AXIS
|
||||
}
|
||||
}
|
||||
else if ( (rterm_id>>4) == 4 ) // Controller (digital)
|
||||
{
|
||||
NewState.Clear();
|
||||
if ( pad == 0 )
|
||||
bObsoleteControllerMessage = true;
|
||||
NewState.Clear();
|
||||
}
|
||||
|
||||
if ( NewState.IsAnyButtonPressed() )
|
||||
@@ -1971,6 +2031,7 @@ void CPad::Update(int16 pad)
|
||||
CGame::bDemoMode = false;
|
||||
#endif
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
#if (defined GTA_PS2 || defined FIX_BUGS)
|
||||
if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(pad))
|
||||
#endif
|
||||
@@ -1984,6 +2045,7 @@ void CPad::Update(int16 pad)
|
||||
PCTempMouseState.Clear();
|
||||
|
||||
ProcessPCSpecificStuff();
|
||||
#endif
|
||||
|
||||
if (NewState.CheckForInput())
|
||||
LastTimeTouched = CTimer::GetTimeInMilliseconds();
|
||||
@@ -3419,6 +3481,7 @@ void CPad::ResetCheats(void)
|
||||
|
||||
}
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
char *CPad::EditString(char *pStr, int32 nSize)
|
||||
{
|
||||
int32 pos = (int32)strlen(pStr);
|
||||
@@ -3631,3 +3694,4 @@ void CPad::FixPadsAfterSave(void)
|
||||
GetPad(0)->Phase = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,16 @@ public:
|
||||
|
||||
bool CheckForInput();
|
||||
void Clear(void);
|
||||
bool IsAnyButtonPressed(void) {
|
||||
return RightStickX || RightStickY ||
|
||||
LeftStickX || LeftStickY ||
|
||||
DPadUp || DPadDown || DPadLeft || DPadRight ||
|
||||
Triangle || Cross || Circle || Square ||
|
||||
Start || Select ||
|
||||
LeftShoulder1 || LeftShoulder2 ||
|
||||
RightShoulder1 || RightShoulder2 ||
|
||||
LeftShock || RightShock;
|
||||
}
|
||||
};
|
||||
VALIDATE_SIZE(CControllerState, 0x2A);
|
||||
|
||||
@@ -148,9 +158,11 @@ public:
|
||||
CControllerState OldState;
|
||||
int16 SteeringLeftRightBuffer[DRUNK_STEERING_BUFFER_SIZE];
|
||||
int32 DrunkDrivingBufferUsed;
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
CControllerState PCTempKeyState;
|
||||
CControllerState PCTempJoyState;
|
||||
CControllerState PCTempMouseState;
|
||||
#endif
|
||||
// straight out of my IDB
|
||||
int16 Phase;
|
||||
int16 Mode;
|
||||
@@ -180,6 +192,7 @@ public:
|
||||
static bool bHasPlayerCheated;
|
||||
static bool bInvertLook4Pad;
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
static CKeyboardState OldKeyState;
|
||||
static CKeyboardState NewKeyState;
|
||||
static CKeyboardState TempKeyState;
|
||||
@@ -187,6 +200,7 @@ public:
|
||||
static CMouseControllerState OldMouseControllerState;
|
||||
static CMouseControllerState NewMouseControllerState;
|
||||
static CMouseControllerState PCTempMouseControllerState;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef GTA_PS2_STUFF
|
||||
@@ -282,6 +296,7 @@ public:
|
||||
void AffectFromXinput(uint32 pad);
|
||||
#endif
|
||||
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
// mouse
|
||||
bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
|
||||
bool GetRightMouseJustDown() { return !!(NewMouseControllerState.RMB && !OldMouseControllerState.RMB); }
|
||||
@@ -422,6 +437,7 @@ public:
|
||||
bool GetLeftWin() { return NewKeyState.LWIN; }
|
||||
bool GetRightWin() { return NewKeyState.RWIN; }
|
||||
bool GetApps() { return NewKeyState.APPS; }
|
||||
#endif
|
||||
// pad
|
||||
|
||||
bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); }
|
||||
|
||||
@@ -351,6 +351,9 @@ enum Config {
|
||||
#define REGISTER_START_BUTTON
|
||||
#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
|
||||
#define BUTTON_ICONS // use textures to show controller buttons
|
||||
#ifdef GTA_PC
|
||||
#define GTA_PC_CONTROLS // enables keyboard and mouse. currently GTA_PC and a few other defines will not work without this
|
||||
#endif
|
||||
|
||||
// Hud, frontend and radar
|
||||
#define PC_MENU
|
||||
|
||||
+6
-1
@@ -378,7 +378,12 @@ DoRWStuffEndOfFrame(void)
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (CPad::GetPad(1)->GetLeftShockJustDown() || CPad::GetPad(0)->GetFJustDown(11)) {
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if (CPad::GetPad(1)->GetLeftShockJustDown() || CPad::GetPad(0)->GetFJustDown(11))
|
||||
#else
|
||||
if (CPad::GetPad(1)->GetLeftShockJustDown())
|
||||
#endif
|
||||
{
|
||||
sprintf(s, "screen_%011lld.png", time(nil));
|
||||
RwGrabScreen(Scene.camera, s);
|
||||
}
|
||||
|
||||
@@ -444,6 +444,7 @@ CMessages::InsertStringInString(wchar *str1, wchar *str2)
|
||||
void
|
||||
CMessages::InsertPlayerControlKeysInString(wchar *str)
|
||||
{
|
||||
#ifdef GTA_PC_CONROLS
|
||||
uint16 i;
|
||||
wchar outstr[256];
|
||||
wchar keybuf[256];
|
||||
@@ -488,6 +489,7 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
|
||||
|
||||
while (i < 256)
|
||||
str[i++] = '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -3103,6 +3103,7 @@ CAutomobile::ProcessControlInputs(uint8 pad)
|
||||
bIsHandbrakeOn = true;
|
||||
|
||||
// Steer left/right
|
||||
#ifdef GTA_PC_CONTROLS
|
||||
if(CCamera::m_bUseMouse3rdPerson && !CVehicle::m_bDisableMouseSteering){
|
||||
if(CPad::GetPad(pad)->GetMouseX() != 0.0f){
|
||||
m_fSteerInput += fMouseSteerSens*CPad::GetPad(pad)->GetMouseX();
|
||||
@@ -3115,7 +3116,9 @@ CAutomobile::ProcessControlInputs(uint8 pad)
|
||||
0.2f*CTimer::GetTimeStep();
|
||||
nLastControlInput = 0;
|
||||
}
|
||||
}else{
|
||||
}else
|
||||
#endif
|
||||
{
|
||||
m_fSteerInput += (-CPad::GetPad(pad)->GetSteeringLeftRight()/128.0f - m_fSteerInput)*
|
||||
0.2f*CTimer::GetTimeStep();
|
||||
nLastControlInput = 0;
|
||||
|
||||
Reference in New Issue
Block a user