Remove unused MOUSE_WARP_DIRECT mode

This commit is contained in:
kichikuou
2023-09-04 17:14:17 +09:00
parent 09086ccc85
commit a4c1dd1acf
4 changed files with 20 additions and 37 deletions
+15 -25
View File
@@ -100,7 +100,7 @@ boolean ags_check_param_xy(int *x, int *y) {
}
void ags_init(const char *render_driver) {
nact->ags.mouse_movesw = MOUSE_WARP_SMOOTH;
nact->ags.mouse_warp_enabled = true;
nact->ags.pal = &pal_256;
nact->ags.world_size.width = SYS35_DEFAULT_WIDTH;
nact->ags.world_size.height = SYS35_DEFAULT_HEIGHT;
@@ -123,7 +123,7 @@ void ags_remove(void) {
}
void ags_reset(void) {
nact->ags.mouse_movesw = MOUSE_WARP_SMOOTH;
nact->ags.mouse_warp_enabled = true;
nact->ags.eventcb = NULL;
initPal(&pal_256);
cg_reset();
@@ -646,31 +646,21 @@ void ags_setCursorLocation(int x, int y, bool is_dibgeo, bool for_selection) {
sdl_sleep(cursor_move_time);
}
#else
switch(nact->ags.mouse_movesw) {
case MOUSE_WARP_DISABLED:
if (!for_selection) {
sdl_setCursorInternalLocation(x, y);
sdl_sleep(cursor_move_time);
if (nact->ags.mouse_warp_enabled) {
MyPoint p;
sys_getMouseInfo(&p, is_dibgeo);
int dx = x - p.x;
int dy = y - p.y;
for (int i = 1; i < 8; i++) {
int xi = ((dx*i*i*i) >> 9) - ((3*dx*i*i)>> 6) + ((3*dx*i) >> 3) + p.x;
int yi = ((dy*i*i*i) >> 9) - ((3*dy*i*i)>> 6) + ((3*dy*i) >> 3) + p.y;
sdl_setCursorLocation(xi, yi);
sdl_sleep(cursor_move_time / 7);
}
break;
case MOUSE_WARP_DIRECT:
sdl_setCursorLocation(x, y);
break;
case MOUSE_WARP_SMOOTH:
{
MyPoint p;
sys_getMouseInfo(&p, is_dibgeo);
int dx = x - p.x;
int dy = y - p.y;
for (int i = 1; i < 8; i++) {
int xi = ((dx*i*i*i) >> 9) - ((3*dx*i*i)>> 6) + ((3*dx*i) >> 3) + p.x;
int yi = ((dy*i*i*i) >> 9) - ((3*dy*i*i)>> 6) + ((3*dy*i) >> 3) + p.y;
sdl_setCursorLocation(xi, yi);
usleep(cursor_move_time * 1000 / 7);
}
sdl_setCursorLocation(x, y);
}
break;
} else if (!for_selection) {
sdl_setCursorInternalLocation(x, y);
sdl_sleep(cursor_move_time);
}
#endif
}
+1 -8
View File
@@ -100,12 +100,6 @@ enum agsevent_button {
AGSEVENT_BUTTON_RIGHT,
};
enum mouse_warp_mode {
MOUSE_WARP_DISABLED,
MOUSE_WARP_DIRECT,
MOUSE_WARP_SMOOTH,
};
struct _ags {
Palette256 *pal; /* system palette */
boolean pal_changed; /* system palette has changed */
@@ -116,11 +110,10 @@ struct _ags {
int world_depth; /* depth of off-screen (bits per pixel) */
enum mouse_warp_mode mouse_movesw;
agsurface_t *dib; /* main surface */
void (*eventcb)(agsevent_t *e); /* deliver event */
bool mouse_warp_enabled;
boolean noantialias; /* antialias を使用しない */
boolean noimagecursor; /* リソースファイルのカーソルを読みこまない */
};
+2 -2
View File
@@ -87,7 +87,7 @@ void
on_item5_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
nact->ags.mouse_movesw = MOUSE_WARP_SMOOTH;
nact->ags.mouse_warp_enabled = true;
gtk_menu_popdown(GTK_MENU(menu_window_popup));
}
@@ -97,7 +97,7 @@ void
on_item6_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
nact->ags.mouse_movesw = MOUSE_WARP_DISABLED;
nact->ags.mouse_warp_enabled = false;
gtk_menu_popdown(GTK_MENU(menu_window_popup));
}
+2 -2
View File
@@ -71,10 +71,10 @@ static void toggle_mouse_warp_mode(void) {
return;
if (menuitem.fState & MFS_CHECKED) {
nact->ags.mouse_movesw = MOUSE_WARP_DISABLED;
nact->ags.mouse_warp_enabled = false;
CheckMenuItem(hmenu, ID_OPTION_MOUSE_MOVE, MF_BYCOMMAND | MFS_UNCHECKED);
} else {
nact->ags.mouse_movesw = MOUSE_WARP_SMOOTH;
nact->ags.mouse_warp_enabled = true;
CheckMenuItem(hmenu, ID_OPTION_MOUSE_MOVE, MF_BYCOMMAND | MFS_CHECKED);
}
}