mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-22 14:23:44 -07:00
gui stuff
This commit is contained in:
parent
9e48935186
commit
78994cb490
5 changed files with 48 additions and 15 deletions
|
@ -609,6 +609,7 @@ namespace SohImGui {
|
|||
|
||||
EnhancementCheckbox("Show Inputs", "gInputEnabled");
|
||||
Tooltip("Shows currently pressed inputs on the bottom right of the screen");
|
||||
EnhancementCheckbox("Mouse/Touch Enabled", "gMouseTouchEnabled");
|
||||
EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled");
|
||||
|
||||
EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false);
|
||||
|
|
|
@ -271,17 +271,14 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
|
|||
PadUtils_UpdateRelXY(input);
|
||||
input->press.stick_x += (s8)(input->cur.stick_x - input->prev.stick_x);
|
||||
input->press.stick_y += (s8)(input->cur.stick_y - input->prev.stick_y);
|
||||
|
||||
u8 buttonDiff2;
|
||||
buttonDiff2 = input->prev.left_click != input->cur.left_click;
|
||||
input->press.left_click = (u8)(input->cur.left_click && buttonDiff2);
|
||||
input->rel.left_click = (u8)(!input->cur.left_click && buttonDiff2);
|
||||
|
||||
buttonDiff2 = input->prev.right_click != input->cur.right_click;
|
||||
input->press.right_click = (u8)(input->cur.right_click && buttonDiff2);
|
||||
input->rel.right_click = (u8)(!input->cur.right_click && buttonDiff2);
|
||||
}
|
||||
|
||||
buttonDiff = input->prev.left_click != input->cur.left_click;
|
||||
input->press.left_click = buttonDiff;
|
||||
|
||||
buttonDiff = input->prev.right_click != input->cur.right_click;
|
||||
input->press.right_click = buttonDiff;
|
||||
|
||||
controllerCallback.rumble = CVar_GetS32("gRumbleEnabled", 0) && (padMgr->rumbleEnable[0] > 0);
|
||||
|
||||
if (HealthMeter_IsCritical()) {
|
||||
|
@ -303,6 +300,7 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) {
|
|||
OTRControllerCallback(&controllerCallback);
|
||||
|
||||
PadMgr_UnlockPadData(padMgr);
|
||||
|
||||
}
|
||||
|
||||
void PadMgr_HandleRetraceMsg(PadMgr* padMgr) {
|
||||
|
|
|
@ -1411,11 +1411,24 @@ s32 Camera_Noop(Camera* camera) {
|
|||
return true;
|
||||
}
|
||||
|
||||
s32 SetCameraManual(Camera* camera) {
|
||||
f32 newCamX = -D_8015BD7C->state.input[0].cur.cam_x;
|
||||
f32 newCamY = D_8015BD7C->state.input[0].cur.cam_y;
|
||||
f32 lastMouseX2;
|
||||
f32 lastMouseY2;
|
||||
|
||||
if ((fabsf(newCamX) >= 350.0f || fabsf(newCamY) >= 350.0f) && manualCamera == false) {
|
||||
s32 SetCameraManual(Camera* camera) {
|
||||
f32 mouseX = D_8015BD7C->state.input[0].cur.touch_x - lastMouseX2;
|
||||
lastMouseX2 = D_8015BD7C->state.input[0].cur.touch_x;
|
||||
f32 mouseY = D_8015BD7C->state.input[0].cur.touch_y - lastMouseY2;
|
||||
lastMouseY2 = D_8015BD7C->state.input[0].cur.touch_y;
|
||||
|
||||
if (CVar_GetS32("gMouseTouchEnabled", 0) != 1) {
|
||||
mouseX = 0.0f;
|
||||
mouseY = 0.0f;
|
||||
}
|
||||
|
||||
f32 newCamX = -D_8015BD7C->state.input[0].cur.cam_x + -(mouseX * 40.0f);
|
||||
f32 newCamY = D_8015BD7C->state.input[0].cur.cam_y + (mouseY * 40.0f);
|
||||
|
||||
if ((fabsf(newCamX) >= 200.0f || fabsf(newCamY) >= 200.0f) && manualCamera == false) {
|
||||
manualCamera = true;
|
||||
|
||||
VecSph eyeAdjustment;
|
||||
|
@ -1510,6 +1523,11 @@ s32 Camera_Free(Camera* camera) {
|
|||
f32 mouseY = D_8015BD7C->state.input[0].cur.touch_y - lastMouseY;
|
||||
lastMouseY = D_8015BD7C->state.input[0].cur.touch_y;
|
||||
|
||||
if (CVar_GetS32("gMouseTouchEnabled", 0) != 1) {
|
||||
mouseX = 0.0f;
|
||||
mouseY = 0.0f;
|
||||
}
|
||||
|
||||
f32 newCamX = -D_8015BD7C->state.input[0].cur.cam_x + -(mouseX * 40.0f);
|
||||
f32 newCamY = D_8015BD7C->state.input[0].cur.cam_y + (mouseY * 40.0f);
|
||||
|
||||
|
|
|
@ -341,7 +341,8 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
if (this->globalState < MAG_STATE_DISPLAY) {
|
||||
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) ||
|
||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) ||
|
||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) || globalCtx->state.input[0].press.left_click) {
|
||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) ||
|
||||
(CVar_GetS32("gMouseTouchEnabled", 0) != 0 && globalCtx->state.input[0].press.left_click)) {
|
||||
|
||||
Audio_PlaySoundGeneral(NA_SE_SY_PIECE_OF_HEART, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8);
|
||||
|
||||
|
@ -368,7 +369,7 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
if (CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_START) ||
|
||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_A) ||
|
||||
CHECK_BTN_ALL(globalCtx->state.input[0].press.button, BTN_B) ||
|
||||
globalCtx->state.input[0].press.left_click) {
|
||||
(CVar_GetS32("gMouseTouchEnabled", 0) != 0 && globalCtx->state.input[0].press.left_click)) {
|
||||
|
||||
if (globalCtx->sceneLoadFlag != 20) {
|
||||
Audio_SetCutsceneFlag(0);
|
||||
|
|
|
@ -164,12 +164,20 @@ void FileChoose_FinishFadeIn(GameState* thisx) {
|
|||
}
|
||||
|
||||
void HandleMouseInput(Input* input) {
|
||||
if (CVar_GetS32("gMouseTouchEnabled", 0) != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (input->press.left_click) {
|
||||
input->press.button = BTN_A;
|
||||
}
|
||||
}
|
||||
|
||||
u8 HandleMouseCursor(FileChooseContext* this, Input* input, int minx, int miny, int maxx, int maxy) {
|
||||
if (CVar_GetS32("gMouseTouchEnabled", 0) != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
float ogratio = 320.0f / 240.0f;
|
||||
float ratio = (float)OTRGetCurrentWidth() / (float)OTRGetCurrentHeight();
|
||||
|
||||
|
@ -188,6 +196,13 @@ u8 HandleMouseCursor(FileChooseContext* this, Input* input, int minx, int miny,
|
|||
}
|
||||
|
||||
Vec2f HandleMouseCursorSplit(FileChooseContext* this, Input* input, int minx, int miny, int maxx, int maxy, int countx, int county) {
|
||||
if (CVar_GetS32("gMouseTouchEnabled", 0) != 1) {
|
||||
Vec2f pos;
|
||||
pos.x = -1;
|
||||
pos.y = -1;
|
||||
return pos;
|
||||
}
|
||||
|
||||
float ogratio = 320.0f / 240.0f;
|
||||
float ratio = (float)OTRGetCurrentWidth() / (float)OTRGetCurrentHeight();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue