diff --git a/src/Entity.c b/src/Entity.c index 6ac057930..8af014cd4 100644 --- a/src/Entity.c +++ b/src/Entity.c @@ -908,6 +908,7 @@ static cc_bool LocalPlayer_HandleFly(int key, struct InputDevice* device) { static cc_bool LocalPlayer_HandleNoclip(int key, struct InputDevice* device) { struct LocalPlayer* p = LocalPlayer_Get(device->index); + p->Hacks._noclipping = true; if (p->Hacks.CanNoclip && p->Hacks.Enabled) { if (p->Hacks.WOMStyleHacks) return true; /* don't handle this here */ @@ -996,10 +997,6 @@ static void LocalPlayer_ReleaseJump(int key, struct InputDevice* device) { LocalPlayer_Get(device->index)->Physics.Jumping = false; } -static cc_bool LocalPlayer_TriggerNoclip(int key, struct InputDevice* device) { - LocalPlayer_Get(device->index)->Hacks._noclipping = true; - return true; -} static void LocalPlayer_ReleaseNoclip(int key, struct InputDevice* device) { LocalPlayer_Get(device->index)->Hacks._noclipping = false; } @@ -1021,10 +1018,8 @@ static void LocalPlayer_HookBinds(void) { Bind_OnReleased[BIND_FLY_UP] = LocalPlayer_ReleaseFlyUp; Bind_OnReleased[BIND_FLY_DOWN] = LocalPlayer_ReleaseFlyDown; - Bind_OnTriggered[BIND_JUMP] = LocalPlayer_TriggerJump; - Bind_OnReleased[BIND_JUMP] = LocalPlayer_ReleaseJump; - - Bind_OnTriggered[BIND_NOCLIP] = LocalPlayer_TriggerNoclip; + Bind_OnTriggered[BIND_JUMP] = LocalPlayer_TriggerJump; + Bind_OnReleased[BIND_JUMP] = LocalPlayer_ReleaseJump; Bind_OnReleased[BIND_NOCLIP] = LocalPlayer_ReleaseNoclip; } diff --git a/src/VirtualCursor.h b/src/VirtualCursor.h index 0c5979a8f..261e698ce 100644 --- a/src/VirtualCursor.h +++ b/src/VirtualCursor.h @@ -3,6 +3,7 @@ #include "Drawer2D.h" #include "Input.h" #include "LBackend.h" +static cc_bool vc_hooked; #define CURSOR_SIZE 1 #define CURSOR_EXTENT 5 @@ -23,6 +24,7 @@ static void VirtualCursor_Display2D(struct Context2D* ctx) { static void VirtualCursor_SetPosition(int x, int y) { x = max(0, min(x, Window_Main.Width - 1)); y = max(0, min(y, Window_Main.Height - 1)); + vc_hooked = true; if (x == Pointers[0].x && y == Pointers[0].y) return; Pointer_SetPosition(0, x, y); diff --git a/src/Window_3DS.c b/src/Window_3DS.c index 78698c6dd..47c252a04 100644 --- a/src/Window_3DS.c +++ b/src/Window_3DS.c @@ -279,7 +279,6 @@ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { OnscreenTextChanged(output); } void OnscreenKeyboard_SetText(const cc_string* text) { } -void OnscreenKeyboard_Draw2D(Rect2D* r, struct Bitmap* bmp) { } void OnscreenKeyboard_Draw3D(void) { } void OnscreenKeyboard_Close(void) { diff --git a/src/Window_Android.c b/src/Window_Android.c index 80f79cc28..9ea46bfe9 100644 --- a/src/Window_Android.c +++ b/src/Window_Android.c @@ -547,7 +547,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) { (*env)->DeleteLocalRef(env, args[0].l); } -void OnscreenKeyboard_Draw2D(Rect2D* r, struct Bitmap* bmp) { } void OnscreenKeyboard_Draw3D(void) { } void OnscreenKeyboard_Close(void) { diff --git a/src/Window_Dreamcast.c b/src/Window_Dreamcast.c index 625c13339..95cd373f6 100644 --- a/src/Window_Dreamcast.c +++ b/src/Window_Dreamcast.c @@ -14,7 +14,6 @@ #include static cc_bool launcherMode; -static cc_bool vc_hooked; #include "VirtualCursor.h" cc_bool window_inited; @@ -204,9 +203,7 @@ static void ProcessMouseInput(float delta) { Input_SetNonRepeatable(CCMOUSE_R, mods & MOUSE_RIGHTBUTTON); Input_SetNonRepeatable(CCMOUSE_M, mods & MOUSE_SIDEBUTTON); - /* Start cursor at window middle */ if (!vc_hooked) { - vc_hooked = true; Pointer_SetPosition(0, Window_Main.Width / 2, Window_Main.Height / 2); } VirtualCursor_SetPosition(Pointers[0].x + state->dx, Pointers[0].y + state->dy); diff --git a/src/Window_N64.c b/src/Window_N64.c index 2f28f25c5..352aee9a6 100644 --- a/src/Window_N64.c +++ b/src/Window_N64.c @@ -184,7 +184,6 @@ void Window_FreeFramebuffer(struct Bitmap* bmp) { *#########################################################################################################################*/ void OnscreenKeyboard_Open(struct OpenKeyboardArgs* args) { /* TODO implement */ } void OnscreenKeyboard_SetText(const cc_string* text) { } -void OnscreenKeyboard_Draw2D(Rect2D* r, struct Bitmap* bmp) { } void OnscreenKeyboard_Draw3D(void) { } void OnscreenKeyboard_Close(void) { /* TODO implement */ } diff --git a/src/Window_PS2.c b/src/Window_PS2.c index 5aeee2f02..08bf48255 100644 --- a/src/Window_PS2.c +++ b/src/Window_PS2.c @@ -151,6 +151,11 @@ static void ProcessMouseInput(float delta) { Input_SetNonRepeatable(CCMOUSE_R, mData.buttons & PS2MOUSE_BTN2); Input_SetNonRepeatable(CCMOUSE_M, mData.buttons & PS2MOUSE_BTN3); Mouse_ScrollVWheel(mData.wheel); + + if (!vc_hooked) { + Pointer_SetPosition(0, Window_Main.Width / 2, Window_Main.Height / 2); + } + VirtualCursor_SetPosition(Pointers[0].x + mData.x, Pointers[0].y + mData.y); if (!Input.RawMode) return; float scale = (delta * 60.0) / 2.0f; diff --git a/src/interop_ios.m b/src/interop_ios.m index cd4bf4d64..a327f7311 100644 --- a/src/interop_ios.m +++ b/src/interop_ios.m @@ -539,7 +539,6 @@ void OnscreenKeyboard_SetText(const cc_string* text) { text_input.text = str; } -void OnscreenKeyboard_Draw2D(Rect2D* r, struct Bitmap* bmp) { } void OnscreenKeyboard_Draw3D(void) { } void OnscreenKeyboard_Close(void) {