mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-23 01:42:19 -05:00
Adds game specific camera options (#1212)
* Adds inversion options * Fixes compilation * Adds options to new detailed control editor * Fixes inversion on C-Up view * Fixes right stick aiming * Fixes right stick aiming again * Adds tooltip function + tooltips to gamecontroleditor.cpp * Fixes tooltip for X axis * Uses LUS tooltip function instead of new one * Adds padding to camera control editor To fit more in line with other enhancement checkboxes
This commit is contained in:
parent
168e84498f
commit
d735616020
@ -25,6 +25,7 @@ void BootCommands_Init()
|
|||||||
CVar_RegisterS32("gDebugEnabled", 0);
|
CVar_RegisterS32("gDebugEnabled", 0);
|
||||||
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
|
CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French
|
||||||
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
|
CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom
|
||||||
|
CVar_RegisterS32("gInvertYAxis", 1);
|
||||||
#if defined(__SWITCH__) || defined(__WIIU__)
|
#if defined(__SWITCH__) || defined(__WIIU__)
|
||||||
CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch/wii u
|
CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch/wii u
|
||||||
#endif
|
#endif
|
||||||
|
@ -216,7 +216,27 @@ namespace GameControlEditor {
|
|||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawUI(bool& open) {
|
void DrawCameraControlPanel() {
|
||||||
|
if (!ImGui::CollapsingHeader("Camera Controls")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImVec2 cursor = ImGui::GetCursorPos();
|
||||||
|
ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5));
|
||||||
|
SohImGui::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis");
|
||||||
|
SohImGui::Tooltip("Inverts the Camera X Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming");
|
||||||
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
|
||||||
|
SohImGui::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis");
|
||||||
|
SohImGui::Tooltip("Inverts the Camera Y Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming");
|
||||||
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
|
||||||
|
SohImGui::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming");
|
||||||
|
SohImGui::Tooltip("Allows for aiming with the rights stick when:\n-Aiming in the C-Up view\n-Aiming with weapons");
|
||||||
|
ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5);
|
||||||
|
SohImGui::PaddedEnhancementCheckbox("Auto-Center First Person View", "gAutoCenterView");
|
||||||
|
SohImGui::Tooltip("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming");
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawUI(bool& open) {
|
||||||
if (!open) {
|
if (!open) {
|
||||||
CVar_SetS32("gGameControlEditorEnabled", false);
|
CVar_SetS32("gGameControlEditorEnabled", false);
|
||||||
return;
|
return;
|
||||||
@ -225,6 +245,7 @@ namespace GameControlEditor {
|
|||||||
ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver);
|
ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver);
|
||||||
if (ImGui::Begin("Game Controls Configuration", &open)) {
|
if (ImGui::Begin("Game Controls Configuration", &open)) {
|
||||||
DrawOcarinaControlPanel();
|
DrawOcarinaControlPanel();
|
||||||
|
DrawCameraControlPanel();
|
||||||
}
|
}
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
@ -1488,8 +1488,8 @@ s32 Camera_Free(Camera* camera) {
|
|||||||
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
|
f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f;
|
||||||
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
|
f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f;
|
||||||
|
|
||||||
camera->globalCtx->camX += newCamX;
|
camera->globalCtx->camX += newCamX * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1);
|
||||||
camera->globalCtx->camY += newCamY;
|
camera->globalCtx->camY += newCamY * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1);
|
||||||
|
|
||||||
if (camera->globalCtx->camY > 0x32A4) {
|
if (camera->globalCtx->camY > 0x32A4) {
|
||||||
camera->globalCtx->camY = 0x32A4;
|
camera->globalCtx->camY = 0x32A4;
|
||||||
|
@ -11175,42 +11175,83 @@ void Player_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
s16 func_8084ABD8(GlobalContext* globalCtx, Player* this, s32 arg2, s16 arg3) {
|
s16 func_8084ABD8(GlobalContext* globalCtx, Player* this, s32 arg2, s16 arg3) {
|
||||||
s32 temp1;
|
s32 temp1;
|
||||||
s16 temp2;
|
s16 temp2;
|
||||||
s16 temp3;
|
s16 temp3;
|
||||||
|
|
||||||
if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) {
|
if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) {
|
||||||
temp2 = sControlInput->rel.stick_y * 240.0f;
|
if (CVar_GetS32("gAutoCenterView", 0) != 0) {
|
||||||
Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30);
|
temp2 = sControlInput->rel.stick_y * 240.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1);
|
||||||
|
Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30);
|
||||||
|
|
||||||
temp2 = sControlInput->rel.stick_x * -16.0f;
|
temp2 = sControlInput->rel.stick_x * -16.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1);
|
||||||
temp2 = CLAMP(temp2, -3000, 3000);
|
temp2 = CLAMP(temp2, -3000, 3000);
|
||||||
this->actor.focus.rot.y += temp2;
|
this->actor.focus.rot.y += temp2;
|
||||||
}
|
} else {
|
||||||
else {
|
temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000;
|
||||||
temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000;
|
temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) *
|
||||||
temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) *
|
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1));
|
||||||
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f);
|
this->actor.focus.rot.x += temp3;
|
||||||
this->actor.focus.rot.x += temp3;
|
|
||||||
|
|
||||||
if (fabsf(sControlInput->cur.gyro_x) > 0.01f) {
|
if (fabsf(sControlInput->cur.gyro_x) > 0.01f) {
|
||||||
this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f;
|
this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fabsf(sControlInput->cur.right_stick_y) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) {
|
||||||
|
this->actor.focus.rot.x -= (sControlInput->cur.right_stick_y) * 10.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1);
|
this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1);
|
||||||
|
|
||||||
temp1 = 19114;
|
temp1 = 19114;
|
||||||
temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y;
|
temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y;
|
||||||
temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) *
|
temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) *
|
||||||
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f);
|
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1));
|
||||||
temp2 += temp3;
|
temp2 += temp3;
|
||||||
|
|
||||||
this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y;
|
this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y;
|
||||||
|
|
||||||
if (fabsf(sControlInput->cur.gyro_y) > 0.01f) {
|
if (fabsf(sControlInput->cur.gyro_y) > 0.01f) {
|
||||||
this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f;
|
this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (fabsf(sControlInput->cur.right_stick_x) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) {
|
||||||
|
this->actor.focus.rot.y += (sControlInput->cur.right_stick_x) * 10.0f * (CVar_GetS32("gInvertXAxis", 0) ? 1 : -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000;
|
||||||
|
temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) *
|
||||||
|
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1));
|
||||||
|
this->actor.focus.rot.x += temp3;
|
||||||
|
|
||||||
|
if (fabsf(sControlInput->cur.gyro_x) > 0.01f) {
|
||||||
|
this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fabsf(sControlInput->cur.right_stick_y) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) {
|
||||||
|
this->actor.focus.rot.x -= (sControlInput->cur.right_stick_y) * 10.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1);
|
||||||
|
|
||||||
|
temp1 = 19114;
|
||||||
|
temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y;
|
||||||
|
temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) *
|
||||||
|
(s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1));
|
||||||
|
temp2 += temp3;
|
||||||
|
|
||||||
|
this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y;
|
||||||
|
|
||||||
|
if (fabsf(sControlInput->cur.gyro_y) > 0.01f) {
|
||||||
|
this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fabsf(sControlInput->cur.right_stick_x) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) {
|
||||||
|
this->actor.focus.rot.y += (sControlInput->cur.right_stick_x) * 10.0f * (CVar_GetS32("gInvertXAxis", 0) ? 1 : -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this->unk_6AE |= 2;
|
this->unk_6AE |= 2;
|
||||||
return func_80836AB8(this, (globalCtx->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) -
|
return func_80836AB8(this, (globalCtx->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) -
|
||||||
|
Loading…
Reference in New Issue
Block a user