mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-23 03:52:12 -04:00
add mouse acceleration to the menu, Crispy settings by default (#1020)
* a few tweaks to mini-thermo * don't translate entire mini-thermo
This commit is contained in:
parent
8a0bb50eca
commit
913530ced9
@ -760,17 +760,21 @@ void I_GetEvent(void)
|
||||
// This is to combine all mouse movement for a tic into one mouse
|
||||
// motion event.
|
||||
|
||||
// The mouse input values are input directly to the game, but when
|
||||
// the values exceed the value of mouse_threshold, they are multiplied
|
||||
// by mouse_acceleration to increase the speed.
|
||||
|
||||
int mouse_acceleration;
|
||||
int mouse_threshold; // 10;
|
||||
int mouse_acceleration_threshold;
|
||||
|
||||
static int AccelerateMouse(int val)
|
||||
{
|
||||
if (val < 0)
|
||||
return -AccelerateMouse(-val);
|
||||
|
||||
if (val > mouse_threshold)
|
||||
if (val > mouse_acceleration_threshold)
|
||||
{
|
||||
return (val - mouse_threshold) * mouse_acceleration / 100 + mouse_threshold;
|
||||
return (val - mouse_acceleration_threshold) * (mouse_acceleration + 10) / 10 + mouse_acceleration_threshold;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
43
src/m_menu.c
43
src/m_menu.c
@ -138,7 +138,7 @@ background_t menu_background;
|
||||
#define M_X_NEXT (310)
|
||||
#define M_Y_PREVNEXT (29 + 18 * M_SPC)
|
||||
#define M_Y_WARN (M_Y_PREVNEXT - M_SPC)
|
||||
#define M_THRM_SIZE 13
|
||||
#define M_THRM_SIZE 10
|
||||
#define M_THRM_STEP 8
|
||||
#define M_THRM_WIDTH (M_THRM_STEP * (M_THRM_SIZE + 2))
|
||||
#define M_X_THRM (M_X - M_THRM_WIDTH)
|
||||
@ -2210,23 +2210,23 @@ static void M_DrawMiniThermo(int x, int y, int size, int dot, char *color)
|
||||
{
|
||||
int xx;
|
||||
int i;
|
||||
const int step = M_THRM_STEP * M_THRM_SIZE / size;
|
||||
const int step = M_THRM_STEP * M_THRM_SIZE * FRACUNIT / size;
|
||||
|
||||
xx = x;
|
||||
V_DrawPatchTranslated(xx, y, 0, W_CacheLumpName("M_MTHRML", PU_CACHE), color);
|
||||
V_DrawPatch(xx, y, 0, W_CacheLumpName("M_MTHRML", PU_CACHE));
|
||||
xx += M_THRM_STEP;
|
||||
for (i = 0; i < M_THRM_SIZE; i++)
|
||||
{
|
||||
V_DrawPatchTranslated(xx, y, 0, W_CacheLumpName("M_MTHRMM", PU_CACHE), color);
|
||||
V_DrawPatch(xx, y, 0, W_CacheLumpName("M_MTHRMM", PU_CACHE));
|
||||
xx += M_THRM_STEP;
|
||||
}
|
||||
V_DrawPatchTranslated(xx, y, 0, W_CacheLumpName("M_MTHRMR", PU_CACHE), color);
|
||||
V_DrawPatch(xx, y, 0, W_CacheLumpName("M_MTHRMR", PU_CACHE));
|
||||
|
||||
// [FG] do not crash anymore if value exceeds thermometer range
|
||||
if (dot > size)
|
||||
dot = size;
|
||||
|
||||
V_DrawPatchTranslated(x + M_THRM_STEP / 2 + dot * step, y, 0,
|
||||
V_DrawPatchTranslated(x + M_THRM_STEP / 2 + dot * step / FRACUNIT, y, 0,
|
||||
W_CacheLumpName("M_MTHRMO", PU_CACHE), color);
|
||||
}
|
||||
|
||||
@ -2481,7 +2481,7 @@ void M_DrawSetting(setup_menu_t* s)
|
||||
const int max = s->var.def->limit.max;
|
||||
const int offsetx = SHORT(hu_font[0]->width);
|
||||
const int offsety = (M_SPC - SHORT(hu_font[0]->height)) / 2;
|
||||
const int size = (max == UL ? M_THRM_SIZE : max);
|
||||
const int size = (max == UL ? M_THRM_SIZE * 2 : max);
|
||||
|
||||
M_DrawMiniThermo(x - offsetx, y - offsety, size, value,
|
||||
ItemDisabled(flags) ? cr_dark : colrngs[color]);
|
||||
@ -4073,6 +4073,8 @@ enum {
|
||||
gen4_mouse1,
|
||||
gen4_mouse2,
|
||||
gen4_mouse3,
|
||||
gen4_mouse_accel,
|
||||
gen4_mouse_accel_threshold,
|
||||
gen4_end1,
|
||||
|
||||
gen4_title2,
|
||||
@ -4083,6 +4085,25 @@ enum {
|
||||
gen4_end2,
|
||||
};
|
||||
|
||||
#define MOUSE_ACCEL_STRINGS_SIZE (40 + 2)
|
||||
|
||||
static const char *mouse_accel_strings[MOUSE_ACCEL_STRINGS_SIZE];
|
||||
|
||||
static void M_InitMouseAccel(void)
|
||||
{
|
||||
int i;
|
||||
char buf[8];
|
||||
|
||||
for (i = 0; i < MOUSE_ACCEL_STRINGS_SIZE - 1; ++i)
|
||||
{
|
||||
int val = i + 10;
|
||||
M_snprintf(buf, sizeof(buf), "%1d.%1d", val / 10, val % 10);
|
||||
mouse_accel_strings[i] = M_StringDuplicate(buf);
|
||||
}
|
||||
|
||||
mouse_accel_strings[i] = NULL;
|
||||
}
|
||||
|
||||
void M_ResetTimeScale(void)
|
||||
{
|
||||
if (strictmode || D_CheckNetConnect())
|
||||
@ -4258,6 +4279,12 @@ setup_menu_t gen_settings4[] = { // General Settings screen4
|
||||
{"Invert vertical axis", S_YESNO, m_null, M_X,
|
||||
M_Y+ gen4_mouse3*M_SPC, {"mouse_y_invert"}},
|
||||
|
||||
{"Mouse acceleration", S_THERMO, m_null, M_X_THRM,
|
||||
M_Y + gen4_mouse_accel * M_SPC, {"mouse_acceleration"}, 0, NULL, mouse_accel_strings},
|
||||
|
||||
{"Mouse threshold", S_NUM, m_null, M_X,
|
||||
M_Y + gen4_mouse_accel_threshold * M_SPC, {"mouse_acceleration_threshold"}},
|
||||
|
||||
{"", S_SKIP, m_null, M_X, M_Y + gen4_end1*M_SPC},
|
||||
|
||||
{"Miscellaneous" ,S_SKIP|S_TITLE, m_null, M_X, M_Y + gen4_title2*M_SPC},
|
||||
@ -7085,6 +7112,8 @@ void M_Init(void)
|
||||
break;
|
||||
}
|
||||
|
||||
M_InitMouseAccel();
|
||||
|
||||
M_ResetMenu(); // killough 10/98
|
||||
M_ResetSetupMenu();
|
||||
M_InitHelpScreen(); // init the help screen // phares 4/08/98
|
||||
|
14
src/m_misc.c
14
src/m_misc.c
@ -83,7 +83,7 @@ extern int grabmouse;
|
||||
extern boolean flipcorpses; // [crispy] randomly flip corpse, blood and death animation sprites
|
||||
extern boolean ghost_monsters; // [crispy] resurrected pools of gore ("ghost monsters") are translucent
|
||||
extern int mouse_acceleration;
|
||||
extern int mouse_threshold;
|
||||
extern int mouse_acceleration_threshold;
|
||||
extern int show_endoom;
|
||||
#if defined(HAVE_FLUIDSYNTH)
|
||||
extern char *soundfont_path;
|
||||
@ -2058,16 +2058,16 @@ default_t defaults[] = {
|
||||
},
|
||||
|
||||
{
|
||||
"cfg_mouse_acceleration",
|
||||
"mouse_acceleration",
|
||||
(config_t *) &mouse_acceleration, NULL,
|
||||
{100}, {100,UL}, number, ss_none, wad_no,
|
||||
"adjust mouse acceleration (100 = no acceleration)"
|
||||
{10}, {0,40}, number, ss_none, wad_no,
|
||||
"adjust mouse acceleration (0 = 1.0, 40 = 5.0)"
|
||||
},
|
||||
|
||||
{
|
||||
"mouse_threshold",
|
||||
(config_t *) &mouse_threshold, NULL,
|
||||
{0}, {0,UL}, number, ss_none, wad_no,
|
||||
"mouse_acceleration_threshold",
|
||||
(config_t *) &mouse_acceleration_threshold, NULL,
|
||||
{10}, {0,32}, number, ss_none, wad_no,
|
||||
"adjust mouse acceleration threshold"
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user