mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 18:15:28 -04:00
PS2: Add mouse cursor crosshairs too, and fix noclip
This commit is contained in:
parent
e7f9ab9797
commit
4eeb4cdb0d
11
src/Entity.c
11
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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include <kos.h>
|
||||
|
||||
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);
|
||||
|
@ -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 */ }
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user