From ad6cfa105e03ede9f56a2c05d23769bc91c86d81 Mon Sep 17 00:00:00 2001 From: terminx Date: Tue, 2 Jan 2007 02:27:31 +0000 Subject: [PATCH] Mouse sensitivity stuff git-svn-id: https://svn.eduke32.com/eduke32@441 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/build/src/build.c | 16 ++++++++-------- polymer/build/src/config.c | 1 - polymer/build/src/defs.c | 9 +++++++++ polymer/build/src/osd.c | 23 +++++++++++++++++++---- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/polymer/build/src/build.c b/polymer/build/src/build.c index 883143276..a229e9dd0 100644 --- a/polymer/build/src/build.c +++ b/polymer/build/src/build.c @@ -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; diff --git a/polymer/build/src/config.c b/polymer/build/src/config.c index a0587528c..d28c83a45 100644 --- a/polymer/build/src/config.c +++ b/polymer/build/src/config.c @@ -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; diff --git a/polymer/build/src/defs.c b/polymer/build/src/defs.c index df5313bcf..cc23f2b66 100644 --- a/polymer/build/src/defs.c +++ b/polymer/build/src/defs.c @@ -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; diff --git a/polymer/build/src/osd.c b/polymer/build/src/osd.c index e94b98226..c0696d415 100644 --- a/polymer/build/src/osd.c +++ b/polymer/build/src/osd.c @@ -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;