option for PC controls

This commit is contained in:
aap 2020-12-21 20:48:40 +01:00
parent 1d7bdce0ef
commit 309a4613a4
10 changed files with 48 additions and 1 deletions

View File

@ -57,6 +57,9 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FLOOR_HIT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
#if GTA_VERSION <= GTA3_PS2_160
{ ANIM_HIT_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
#endif
{ ANIM_HIT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_CHEST, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
{ ANIM_HIT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
@ -78,6 +81,8 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_HGUN_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
{ ANIM_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
#ifdef PC_PLAYER_CONTROLS
// maybe wrong define, but unused anyway
{ ANIM_FPS_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_BAT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_UZI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
@ -85,6 +90,7 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_FPS_AK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_M16, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FPS_ROCKET, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
#endif
{ ANIM_FIGHT_IDLE, ASSOC_REPEAT },
{ ANIM_FIGHT2_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_FIGHT_SH_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
@ -193,6 +199,7 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
};
#ifdef PC_PLAYER_CONTROLS
AnimAssocDesc aStdAnimDescsSide[] = {
{ ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
{ ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
@ -200,6 +207,7 @@ AnimAssocDesc aStdAnimDescsSide[] = {
{ ANIM_IDLE_STANCE, ASSOC_REPEAT },
{ ANIM_WALK_START, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
};
#endif
char const *aStdAnimations[] = {
"walk_civi",
"run_civi",
@ -239,6 +247,9 @@ char const *aStdAnimations[] = {
"HIT_back",
"HIT_R",
"FLOOR_hit",
#if GTA_VERSION <= GTA3_PS2_160
"HIT_body",
#endif
"HIT_bodyblow",
"HIT_chest",
"HIT_head",
@ -260,6 +271,8 @@ char const *aStdAnimations[] = {
"bomber",
"WEAPON_hgun_rload",
"WEAPON_AK_rload",
#ifdef PC_PLAYER_CONTROLS
// maybe wrong define, but unused anyway
"FPS_PUNCH",
"FPS_BAT",
"FPS_UZI",
@ -267,6 +280,7 @@ char const *aStdAnimations[] = {
"FPS_AK",
"FPS_M16",
"FPS_ROCKET",
#endif
"FIGHTIDLE",
"FIGHT2IDLE",
"FIGHTsh_F",
@ -488,6 +502,7 @@ char const *aPanicChunkyAnimations[] = {
"woman_runpanic",
"idle_stance",
};
#ifdef PC_PLAYER_CONTROLS
char const *aPlayerStrafeBackAnimations[] = {
"walk_player_back",
"run_player_back",
@ -530,6 +545,7 @@ char const *aRocketStrafeRightAnimations[] = {
"idle_rocket",
"walkst_rocket_right",
};
#endif
#define awc(a) ARRAY_SIZE(a), a
const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS] = {
@ -552,12 +568,14 @@ const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_
{ "oldwoman", "ped", MI_COP, awc(aOldWomanAnimations), aStdAnimDescs },
{ "fatwoman", "ped", MI_COP, awc(aFatWomanAnimations), aStdAnimDescs },
{ "panicchunky", "ped", MI_COP, awc(aPanicChunkyAnimations), aStdAnimDescs },
#ifdef PC_PLAYER_CONTROLS
{ "playerback", "ped", MI_COP, awc(aPlayerStrafeBackAnimations), aStdAnimDescs },
{ "playerleft", "ped", MI_COP, awc(aPlayerStrafeLeftAnimations), aStdAnimDescsSide },
{ "playerright", "ped", MI_COP, awc(aPlayerStrafeRightAnimations), aStdAnimDescsSide },
{ "rocketback", "ped", MI_COP, awc(aRocketStrafeBackAnimations), aStdAnimDescs },
{ "rocketleft", "ped", MI_COP, awc(aRocketStrafeLeftAnimations), aStdAnimDescsSide },
{ "rocketright", "ped", MI_COP, awc(aRocketStrafeRightAnimations), aStdAnimDescsSide },
#endif
};
#undef awc

View File

@ -24,12 +24,14 @@ enum AssocGroupId
ASSOCGRP_OLDWOMAN,
ASSOCGRP_FATWOMAN,
ASSOCGRP_PANICCHUNKY,
#ifdef PC_PLAYER_CONTROLS
ASSOCGRP_PLAYERBACK,
ASSOCGRP_PLAYERLEFT,
ASSOCGRP_PLAYERRIGHT,
ASSOCGRP_ROCKETBACK,
ASSOCGRP_ROCKETLEFT,
ASSOCGRP_ROCKETRIGHT,
#endif
NUM_ANIM_ASSOC_GROUPS
};

View File

@ -40,6 +40,9 @@ enum AnimationId
ANIM_HIT_BACK,
ANIM_HIT_RIGHT,
ANIM_FLOOR_HIT,
#if GTA_VERSION <= GTA3_PS2_160
ANIM_HIT_BODY,
#endif
ANIM_HIT_BODYBLOW,
ANIM_HIT_CHEST,
ANIM_HIT_HEAD,
@ -61,6 +64,8 @@ enum AnimationId
ANIM_BOMBER,
ANIM_HGUN_RELOAD,
ANIM_AK_RELOAD,
#ifdef PC_PLAYER_CONTROLS
// maybe wrong define, but unused anyway
ANIM_FPS_PUNCH,
ANIM_FPS_BAT,
ANIM_FPS_UZI,
@ -68,6 +73,7 @@ enum AnimationId
ANIM_FPS_AK,
ANIM_FPS_M16,
ANIM_FPS_ROCKET,
#endif
ANIM_FIGHT_IDLE,
ANIM_FIGHT2_IDLE,
ANIM_FIGHT_SH_F,

View File

@ -144,9 +144,11 @@ CCam::Process(void)
Process_BehindCar(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
case MODE_FOLLOWPED:
#ifdef PC_PLAYER_CONTROLS
if(CCamera::m_bUseMouse3rdPerson)
Process_FollowPedWithMouse(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
else
#endif
#ifdef FREE_CAM
if(CCamera::bFreeCam)
Process_FollowPed_Rotation(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
@ -3673,6 +3675,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
if(TheCamera.m_bUseSpecialFovTrain)
FOV = TheCamera.m_fFovForTrain;
#ifdef PC_PLAYER_CONTROLS
if(CMenuManager::m_ControlMethod == CONTROL_STANDARD && Using3rdPersonMouseCam()){
CPed *player = FindPlayerPed();
if(player && player->CanStrafeOrMouseControl()){
@ -3683,6 +3686,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
TheCamera.pTargetEntity->GetMatrix().UpdateRW();
}
}
#endif
}
void

View File

@ -60,7 +60,11 @@ enum
// NB: removed explicit TheCamera from all functions
CCamera TheCamera;
#ifdef PC_PLAYER_CONTROLS
bool CCamera::m_bUseMouse3rdPerson = true;
#else
bool CCamera::m_bUseMouse3rdPerson = false;
#endif
bool bDidWeProcessAnyCinemaCam;
#ifdef IMPROVED_CAMERA

View File

@ -1023,7 +1023,9 @@ CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostR
void
CMenuManager::DoSettingsBeforeStartingAGame()
{
#ifdef PC_PLAYER_CONTROLS
CCamera::m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
#endif
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
@ -4064,7 +4066,9 @@ CMenuManager::Process(void)
#ifdef USE_DEBUG_SCRIPT_LOADER
scriptToLoad = 0;
#endif
#ifdef PC_PLAYER_CONTROLS
TheCamera.m_bUseMouse3rdPerson = m_ControlMethod == CONTROL_STANDARD;
#endif
if (m_PrefsVsyncDisp != m_PrefsVsync)
m_PrefsVsync = m_PrefsVsyncDisp;
DMAudio.Service();

View File

@ -271,7 +271,9 @@ CMenuScreen aScreens[MENUPAGES] = {
// MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
#ifdef PC_PLAYER_CONTROLS
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
#endif
MENUACTION_KEYBOARDCTRLS,"FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,

View File

@ -635,7 +635,9 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
// MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
#ifdef PC_PLAYER_CONTROLS
MENUACTION_CTRLMETHOD, "FET_CME", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
#endif
MENUACTION_KEYBOARDCTRLS,"FET_RDK", { nil, SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS },
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
MENUACTION_CHANGEMENU, "FEC_JOD", { nil, SAVESLOT_NONE, MENUPAGE_DETECT_JOYSTICK },

View File

@ -196,6 +196,7 @@ enum Config {
# define RANDOMSPLASH // use random splash as on PS2
# define PS2_MATFX
# endif
# define PC_PLAYER_CONTROLS // mouse player/cam mode
# define GTA_REPLAY
# define GTA_SCENE_EDIT
#elif defined GTA_XBOX

View File

@ -929,6 +929,8 @@ void
CPlayerPed::ProcessAnimGroups(void)
{
AssocGroupId groupToSet;
#ifdef PC_PLAYER_CONTROLS
if ((m_fWalkAngle <= -DEGTORAD(50.0f) || m_fWalkAngle >= DEGTORAD(50.0f))
&& TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam()
&& CanStrafeOrMouseControl()) {
@ -951,7 +953,9 @@ CPlayerPed::ProcessAnimGroups(void)
else
groupToSet = ASSOCGRP_PLAYERBACK;
}
} else {
} else
#endif
{
if (GetWeapon()->m_eWeaponType == WEAPONTYPE_ROCKETLAUNCHER) {
groupToSet = ASSOCGRP_PLAYERROCKET;
} else {