mirror of
https://github.com/HarbourMasters/2ship2harkinian.git
synced 2024-11-26 15:50:25 +00:00
Add gi invert pattern (#441)
This commit is contained in:
parent
0ce2df93e3
commit
a8ffb5bcb6
@ -151,8 +151,8 @@ void Camera_DebugCam(Camera* camera) {
|
||||
f32 yawDiff = -sCamPlayState->state.input[controllerPort].cur.right_stick_x * 10.0f * (CVarGetFloat("gEnhancements.Camera.RightStick.CameraSensitivity.X", 1.0f));
|
||||
f32 pitchDiff = sCamPlayState->state.input[controllerPort].cur.right_stick_y * 10.0f * (CVarGetFloat("gEnhancements.Camera.RightStick.CameraSensitivity.Y", 1.0f));
|
||||
|
||||
yawDiff *= (CVarGetInteger("gEnhancements.Camera.RightStick.InvertXAxis", 0) ? -1 : 1);
|
||||
pitchDiff *= (CVarGetInteger("gEnhancements.Camera.RightStick.InvertYAxis", 1) ? 1 : -1);
|
||||
yawDiff *= GameInteractor_InvertControl(GI_INVERT_CAMERA_RIGHT_STICK_X);
|
||||
pitchDiff *= -GameInteractor_InvertControl(GI_INVERT_CAMERA_RIGHT_STICK_Y);
|
||||
|
||||
// Setup new camera angle based on the calculations from right stick inputs
|
||||
if (CVarGetInteger("gEnhancements.Camera.DebugCam.6DOF", 0)) {
|
||||
|
@ -93,8 +93,8 @@ bool Camera_FreeLook(Camera* camera) {
|
||||
f32 yawDiff = -sCamPlayState->state.input[0].cur.right_stick_x * 10.0f * (CVarGetFloat("gEnhancements.Camera.RightStick.CameraSensitivity.X", 1.0f));
|
||||
f32 pitchDiff = sCamPlayState->state.input[0].cur.right_stick_y * 10.0f * (CVarGetFloat("gEnhancements.Camera.RightStick.CameraSensitivity.Y", 1.0f));
|
||||
|
||||
yaw += yawDiff * (CVarGetInteger("gEnhancements.Camera.RightStick.InvertXAxis", 0) ? -1 : 1);
|
||||
pitch += pitchDiff * (CVarGetInteger("gEnhancements.Camera.RightStick.InvertYAxis", 1) ? 1 : -1);
|
||||
yaw += yawDiff * GameInteractor_InvertControl(GI_INVERT_CAMERA_RIGHT_STICK_X);
|
||||
pitch += pitchDiff * -GameInteractor_InvertControl(GI_INVERT_CAMERA_RIGHT_STICK_Y);
|
||||
|
||||
s16 maxPitch = DEG_TO_BINANG(CVarGetFloat("gEnhancements.Camera.FreeLook.MaxPitch", 72.0f));
|
||||
s16 minPitch = DEG_TO_BINANG(CVarGetFloat("gEnhancements.Camera.FreeLook.MinPitch", -49.0f));
|
||||
|
@ -173,3 +173,40 @@ bool GameInteractor_Should(GIVanillaBehavior flag, bool result, void* opt) {
|
||||
GameInteractor::Instance->ExecuteHooksForFilter<GameInteractor::ShouldVanillaBehavior>(flag, &result, opt);
|
||||
return result;
|
||||
}
|
||||
|
||||
// Returns 1 or -1 based on a number of factors like CVars or other game states.
|
||||
int GameInteractor_InvertControl(GIInvertType type) {
|
||||
int result = 1;
|
||||
|
||||
switch (type) {
|
||||
case GI_INVERT_CAMERA_RIGHT_STICK_X:
|
||||
if (CVarGetInteger("gEnhancements.Camera.RightStick.InvertXAxis", 0)) {
|
||||
result *= -1;
|
||||
}
|
||||
break;
|
||||
case GI_INVERT_CAMERA_RIGHT_STICK_Y:
|
||||
if (CVarGetInteger("gEnhancements.Camera.RightStick.InvertYAxis", 1)) {
|
||||
result *= -1;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
// Invert all X axis inputs if the Mirrored World mode is enabled
|
||||
if (CVarGetInteger("gModes.MirroredWorld.State", 0)) {
|
||||
switch (type) {
|
||||
case GI_INVERT_CAMERA_RIGHT_STICK_X:
|
||||
result *= -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
if (CrowdControl::State::InvertedInputs) {
|
||||
result *= -1;
|
||||
}
|
||||
*/
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -50,6 +50,11 @@ typedef enum {
|
||||
GI_VB_TATL_INTERUPT_MSG6
|
||||
} GIVanillaBehavior;
|
||||
|
||||
typedef enum {
|
||||
GI_INVERT_CAMERA_RIGHT_STICK_X,
|
||||
GI_INVERT_CAMERA_RIGHT_STICK_Y,
|
||||
} GIInvertType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <vector>
|
||||
@ -297,6 +302,8 @@ bool GameInteractor_Should(GIVanillaBehavior flag, bool result, void* optionalAr
|
||||
#define REGISTER_VB_SHOULD(flag, body) \
|
||||
GameInteractor::Instance->RegisterGameHookForID<GameInteractor::ShouldVanillaBehavior>(flag, [](GIVanillaBehavior _, bool* should, void* opt) body)
|
||||
|
||||
int GameInteractor_InvertControl(GIInvertType type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user