CON fix from JFDuke that I missed somewhere along the line + SDL mousewheel fix from Mephisto

git-svn-id: https://svn.eduke32.com/eduke32@258 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-08-07 06:18:57 +00:00
parent ab6da3c5a4
commit 660815a3fd
5 changed files with 38 additions and 25 deletions

View file

@ -7446,7 +7446,7 @@ void loadtile(short tilenume)
kread(artfil,ptr,dasiz); kread(artfil,ptr,dasiz);
faketimerhandler(); faketimerhandler();
artfilplc = tilefileoffs[tilenume]+dasiz; artfilplc = tilefileoffs[tilenume]+dasiz;
} else Bmemset((char *)waloff[tilenume],1,dasiz); } else Bmemset((char *)waloff[tilenume],0,dasiz);
} }

View file

@ -39,6 +39,10 @@ int startwin_settitle(const char *s) { s=s; return 0; }
// undefine to restrict windowed resolutions to conventional sizes // undefine to restrict windowed resolutions to conventional sizes
#define ANY_WINDOWED_SIZE #define ANY_WINDOWED_SIZE
// fix for mousewheel
#define MWHEELTICKS 10
static unsigned long mwheelup, mwheeldown;
int _buildargc = 1; int _buildargc = 1;
char **_buildargv = NULL; char **_buildargv = NULL;
extern long app_main(long argc, char *argv[]); extern long app_main(long argc, char *argv[]);
@ -1299,14 +1303,22 @@ int handleevents(void)
case SDL_BUTTON_LEFT: j = 0; break; case SDL_BUTTON_LEFT: j = 0; break;
case SDL_BUTTON_RIGHT: j = 1; break; case SDL_BUTTON_RIGHT: j = 1; break;
case SDL_BUTTON_MIDDLE: j = 2; break; case SDL_BUTTON_MIDDLE: j = 2; break;
default: j = -1; break; default: j = ev.button.button; break;
} }
if (j<0) break; if (j<0) break;
if (ev.button.state == SDL_PRESSED) if (ev.button.state == SDL_PRESSED) {
if (ev.button.button == SDL_BUTTON_WHEELUP) {
mwheelup = totalclock;
}
if (ev.button.button == SDL_BUTTON_WHEELDOWN) {
mwheeldown = totalclock;
}
mouseb |= (1<<j); mouseb |= (1<<j);
else }
mouseb &= ~(1<<j); else {
if (j < 4) mouseb &= ~(1<<j);
}
if (mousepresscallback) if (mousepresscallback)
mousepresscallback(j+1, ev.button.state == SDL_PRESSED); mousepresscallback(j+1, ev.button.state == SDL_PRESSED);
@ -1371,6 +1383,17 @@ int handleevents(void)
sampletimer(); sampletimer();
if (moustat) {
if ((mwheelup) && (mwheelup <= (totalclock - MWHEELTICKS))) {
mouseb &= ~16;
mwheelup = 0;
}
if ((mwheeldown) && (mwheeldown <= (totalclock - MWHEELTICKS))) {
mouseb &= ~32;
mwheeldown = 0;
}
}
startwin_idle(NULL); startwin_idle(NULL);
#undef SetKey #undef SetKey

View file

@ -7667,10 +7667,16 @@ static tokenlist rancidtokens[] =
extern const char *getexternaladdress(void); extern const char *getexternaladdress(void);
static int parse_rancid_net(scriptfile *script) int load_rancid_net(char *fn)
{ {
int tokn; int tokn;
char *cmdtokptr; char *cmdtokptr;
scriptfile *script;
script = scriptfile_fromfile(fn);
if (!script) return -1;
while (1) { while (1) {
tokn = getatoken(script,rancidtokens,sizeof(rancidtokens)/sizeof(tokenlist)); tokn = getatoken(script,rancidtokens,sizeof(rancidtokens)/sizeof(tokenlist));
cmdtokptr = script->ltextptr; cmdtokptr = script->ltextptr;
@ -7712,17 +7718,6 @@ static int parse_rancid_net(scriptfile *script)
break; break;
} }
} }
return 0;
}
int load_rancid_net(char *fn)
{
scriptfile *script;
script = scriptfile_fromfile(fn);
if (!script) return -1;
parse_rancid_net(script);
scriptfile_close(script); scriptfile_close(script);
scriptfile_clearsymbols(); scriptfile_clearsymbols();
@ -7997,12 +7992,7 @@ void checkcommandline(int argc,char **argv)
{ {
Bstrcpy(confilename,c); Bstrcpy(confilename,c);
userconfiles = 1; userconfiles = 1;
/* if(SafeFileExists(c) == 0) initprintf("Using CON file: '%s'\n",confilename);
{
initprintf("Could not find CON file '%s'.\n",confilename );
exit(-1);
}
else */ initprintf("Using CON file: '%s'\n",confilename);
} }
break; break;
case 'g': case 'g':

View file

@ -2601,7 +2601,7 @@ char parsecommand(void)
{ {
if(keyword() >= 0) if(keyword() >= 0)
{ {
scriptptr += (4-j); for (i=4-j; i; i--) *(scriptptr++) = 0;
break; break;
} }
switch(j) switch(j)

View file

@ -3928,7 +3928,7 @@ SKIPJIBS:
case CON_DEBUG: case CON_DEBUG:
insptr++; insptr++;
printf("%ld\n",*insptr++); initprintf("%ld\n",*insptr++);
break; break;
case CON_ENDOFGAME: case CON_ENDOFGAME: