Mouse sensitivity stuff

git-svn-id: https://svn.eduke32.com/eduke32@441 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2007-01-02 02:27:31 +00:00
parent 4bc6daa489
commit ad6cfa105e
4 changed files with 36 additions and 13 deletions

View File

@ -531,14 +531,14 @@ void editinput(void)
mousy = (mousy<<16)+mouseysurp;
{
ldiv_t ld;
ld = ldiv((long)((double)mousx*msens), (1<<16)); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((long)((double)mousy*msens), (1<<16)); mousy = ld.quot; mouseysurp = ld.rem;
ld = ldiv((long)(mousx), (1<<16)); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((long)(mousy), (1<<16)); mousy = ld.quot; mouseysurp = ld.rem;
}
if (mlook == 1)
{
ang += mousx>>1;
horiz -= (mousy>>2);
ang += (mousx>>1)*msens;
horiz -= (mousy>>2)*msens;
if (mousy && !(mousy>>2))
horiz--;
@ -2832,11 +2832,11 @@ void overheadeditor(void)
mousy = (mousy<<16)+mouseysurp;
{
ldiv_t ld;
ld = ldiv((long)((double)mousx*msens), (1<<16)); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((long)((double)mousy*msens), (1<<16)); mousy = ld.quot; mouseysurp = ld.rem;
ld = ldiv((long)(mousx), (1<<16)); mousx = ld.quot; mousexsurp = ld.rem;
ld = ldiv((long)(mousy), (1<<16)); mousy = ld.quot; mouseysurp = ld.rem;
}
searchx += mousx;
searchy += mousy;
searchx += mousx*msens;
searchy += mousy*msens;
if (searchx < 8) searchx = 8;
if (searchx > xdim-8-1) searchx = xdim-8-1;
if (searchy < 8) searchy = 8;

View File

@ -173,7 +173,6 @@ if (readconfig(fp, "renderer", val, VL) > 0) { i = Batoi(val); setrendermode(i);
if (readconfig(fp, "keyconsole", val, VL) > 0) { keys[19] = Bstrtol(val, NULL, 16); OSD_CaptureKey(keys[19]); }
if (readconfig(fp, "mousesensitivity", val, VL) > 0) msens = Bstrtod(val, NULL);
Bfclose(fp);
return 0;

View File

@ -62,6 +62,7 @@ enum {
T_FOGPAL,
T_LOADGRP,
T_DUMMYTILE,T_DUMMYTILERANGE,
T_CACHESIZE
};
typedef struct { char *text; int tokenid; } tokenlist;
@ -107,6 +108,7 @@ static tokenlist basetokens[] =
{ "loadgrp", T_LOADGRP },
{ "dummytile", T_DUMMYTILE },
{ "dummytilerange", T_DUMMYTILERANGE },
{ "cachesize", T_CACHESIZE },
};
static tokenlist modeltokens[] = {
@ -407,6 +409,13 @@ static int defsparser(scriptfile *script)
scriptfile_getstring(script,&bs);
}
break;
case T_CACHESIZE:
{
int j;
if (scriptfile_getnumber(script,&j)) break;
}
break;
case T_DUMMYTILE:
{
int tile, xsiz, ysiz, j;

View File

@ -59,6 +59,7 @@ static BFILE *osdlog=NULL; // log filehandle
static char osdinited=0; // text buffer initialised?
static int osdkey=0x29; // tilde shows the osd
static int keytime=0;
static long osdscrtime = 0;
// command prompt editing
#define EDITLENGTH 512
@ -373,6 +374,7 @@ int OSD_HandleKey(int sc, int press)
osdscroll = -1;
osdrowscur += osdscroll;
OSD_CaptureInput(osdscroll == 1);
osdscrtime = getticks();
}
return 0;//sc;
} else if (!osdinput) {
@ -519,6 +521,7 @@ int OSD_HandleKey(int sc, int press)
osdscroll = -1;
osdrowscur += osdscroll;
OSD_CaptureInput(0);
osdscrtime = getticks();
} else if (sc == 201) { // page up
if (osdhead < osdlines-1)
osdhead++;
@ -704,6 +707,7 @@ void OSD_ShowDisplay(int onf)
//
// OSD_Draw() -- Draw the onscreen display
//
void OSD_Draw(void)
{
unsigned topoffs;
@ -718,11 +722,22 @@ void OSD_Draw(void)
osdscroll = 0;
else
{
/*
int i = getticks();
if (!osdscrtime) osdscrtime = i;
*/
if ((osdrowscur < osdrows && osdscroll == 1) || osdrowscur < -1)
osdrowscur++;
else if ((osdrowscur > -1 && osdscroll == -1) || osdrowscur > osdrows)
osdrowscur--;
}
osdrowscur += 1;//(i-osdscrtime)>>3;
if ((osdrowscur > -1 && osdscroll == -1) || osdrowscur > osdrows)
osdrowscur -= 1;//(i-osdscrtime)>>3;
/*
if (osdrowscur > osdrows) osdrowscur = osdrows;
if (osdrowscur < -1) osdrowscur = -1;
OSD_Printf("%ld\n",(i-osdscrtime)>>3);
osdscrtime = i;
*/
}
if (!osdvisible || !osdrowscur) return;