[saco] Implement/match CPlayerPed::GetKeys(...)

This commit is contained in:
RD42 2024-10-15 16:55:38 +08:00
parent 3e5f6d3379
commit f6f40b4309
2 changed files with 59 additions and 0 deletions

View File

@ -78,6 +78,63 @@ void CPlayerPed::SetInitialState()
//-----------------------------------------------------------
WORD CPlayerPed::GetKeys(WORD * lrAnalog, WORD * udAnalog)
{
WORD wRet=0;
GTA_CONTROLSET *pInternalKeys = GameGetInternalKeys();
*lrAnalog = pInternalKeys->wKeys1[0]; // left/right analog
*udAnalog = pInternalKeys->wKeys1[1]; // up/down analog
if(((short)pInternalKeys->wKeys1[2]) > 0) wRet |= 1; // analog2 L
wRet <<= 1;
if(((short)pInternalKeys->wKeys1[2]) < 0) wRet |= 1; // analog2 R
wRet <<= 1;
if(((short)pInternalKeys->wKeys1[3]) > 0) wRet |= 1; // analog2 D
wRet <<= 1;
if(((short)pInternalKeys->wKeys1[3]) < 0) wRet |= 1; // analog2 U
wRet <<= 1;
if(pInternalKeys->wKeys1[21]) wRet |= 1; // walking
wRet <<= 1;
if(pInternalKeys->wKeys1[19]) wRet |= 1; // submission
wRet <<= 1;
if(IsInVehicle() && pInternalKeys->wKeys1[5]) wRet |= 1; // incar look left
wRet <<= 1;
if(pInternalKeys->wKeys1[6]) wRet |= 1; // incar handbrake / target
wRet <<= 1;
if(IsInVehicle() && pInternalKeys->wKeys1[7]) wRet |= 1; // incar look right
wRet <<= 1;
if(pInternalKeys->wKeys1[14]) wRet |= 1; // jump
wRet <<= 1;
if(!IsInJetpackMode() && pInternalKeys->wKeys1[15]) wRet |= 1; // secondary onfoot attack
wRet <<= 1;
if(pInternalKeys->wKeys1[16]) wRet |= 1; // sprint
wRet <<= 1;
if(HasAmmoForCurrentWeapon() && pInternalKeys->wKeys1[17]) wRet |= 1; // fire
wRet <<= 1;
if(pInternalKeys->wKeys1[18]) wRet |= 1; // crouch
wRet <<= 1;
if(pInternalKeys->wKeys1[4]) wRet |= 1; // secondary fire
return wRet;
}
//-----------------------------------------------------------
BYTE CPlayerPed::GetSpecialKey()
{
GTA_CONTROLSET *pInternalKeys = GameGetInternalKeys();

View File

@ -19,6 +19,8 @@ public:
void ResetPointers();
void SetInitialState();
WORD GetKeys(WORD * lrAnalog, WORD * udAnalog);
BYTE GetSpecialKey();
CAMERA_AIM * GetCurrentAim();