Some sound fixes and a cl_smoothinput cvar to allow people to disable the lastinfo.dyaw and lastinfo.dz stuff in getinput()

git-svn-id: https://svn.eduke32.com/eduke32@159 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-05-10 21:00:56 +00:00
parent a8abb5e046
commit 9b45f1ba55
6 changed files with 50 additions and 26 deletions

View file

@ -64,6 +64,7 @@ int32 RunMode;
int32 AutoAim; // JBF 20031125
int32 ShowOpponentWeapons;
int32 MouseFilter;
int32 SmoothInput;
// JBF 20031211: Store the input settings because
// (currently) jmact can't regurgitate them
@ -214,6 +215,7 @@ void CONFIG_SetDefaults( void )
ReverseStereo = 0;
RunMode = ud.auto_run = 1;
ShowOpponentWeapons = 0;
SmoothInput = 1;
SoundToggle = 1;
ud.automsg = 0;
ud.autovote = 0;
@ -569,14 +571,13 @@ void CONFIG_ReadSetup( void )
SCRIPT_GetString( scripthandle, "Comm Setup",commmacro,&ud.ridecule[dummy][0]);
}
SCRIPT_GetString( scripthandle, "Comm Setup","PlayerName",&myname[0]);
SCRIPT_GetString( scripthandle, "Comm Setup","PlayerName",&tempbuf);
if(Bstrlen(strip_color_codes(myname)) > 9)
{
Bstrcpy(tempbuf,myname);
Bstrncpy(myname,strip_color_codes(tempbuf),9);
myname[10] = '\0';
}
while(Bstrlen(strip_color_codes(tempbuf)) > 10)
tempbuf[Bstrlen(tempbuf)-1] = '\0';
Bstrncpy(myname,tempbuf,sizeof(myname)-1);
myname[sizeof(myname)] = '\0';
SCRIPT_GetString( scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
@ -654,7 +655,8 @@ void CONFIG_ReadSetup( void )
SCRIPT_GetNumber( scripthandle, "Controls","ControllerType",&ControllerType);
SCRIPT_GetNumber( scripthandle, "Controls","MouseAimingFlipped",&ud.mouseflip); // mouse aiming inverted
SCRIPT_GetNumber( scripthandle, "Controls","MouseAiming",&ud.mouseaiming); // 1=momentary/0=toggle
SCRIPT_GetNumber( scripthandle, "Controls","MouseFilter",&MouseFilter); // 1=momentary/0=toggle
SCRIPT_GetNumber( scripthandle, "Controls","MouseFilter",&MouseFilter);
SCRIPT_GetNumber( scripthandle, "Controls","SmoothInput",&SmoothInput);
//SCRIPT_GetNumber( scripthandle, "Controls","GameMouseAiming",(int32 *)&ps[0].aim_mode); // dupe of below (?)
ps[0].aim_mode = ud.mouseaiming;
SCRIPT_GetNumber( scripthandle, "Controls","AimingFlag",(int32 *)&myaimmode); // (if toggle mode) gives state
@ -714,6 +716,7 @@ void CONFIG_WriteSetup( void )
SCRIPT_PutNumber( scripthandle, "Controls", "MouseAimingFlipped",ud.mouseflip,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","MouseAiming",ud.mouseaiming,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","MouseFilter",MouseFilter,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","SmoothInput",SmoothInput,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","RunKeyBehaviour",ud.runkey_mode,false,false);
SCRIPT_PutNumber( scripthandle, "Controls","WeaponSwitchMode",ud.weaponswitch,false,false);

View file

@ -46,6 +46,7 @@ extern int32 ControllerType;
extern int32 RunMode;
extern int32 AutoAim;
extern int32 MouseFilter;
extern int32 SmoothInput;
extern int32 ShowOpponentWeapons;
extern int32 ScreenMode;
extern int32 ScreenWidth;

View file

@ -59,7 +59,7 @@ char volume_names[MAXVOLUMES][33] = { "L.A. MELTDOWN", "LUNAR APOCALYPSE", "SHRA
char skill_names[5][33] = { "PIECE OF CAKE", "LET'S ROCK", "COME GET SOME", "DAMN I'M GOOD" };
char gametype_names[MAXGAMETYPES][33] = { "DUKEMATCH (SPAWN)","COOPERATIVE PLAY","DUKEMATCH (NO SPAWN)"};
int gametype_flags[MAXGAMETYPES] = {4+8+16+256+1024+2048+16384,1+2+32+64+128+256+512+4096+8192+32768,2+4+8+16+256+16384};
int gametype_flags[MAXGAMETYPES] = {4+8+16+1024+2048+16384,1+2+32+64+128+256+512+4096+8192+32768,2+4+8+16+16384};
char num_gametypes = 3;
long soundsiz[NUM_SOUNDS];

View file

@ -451,6 +451,7 @@ struct cvarmappings {
{ "cl_showcoords", "cl_showcoords: show your position in the game world", (void*)&ud.coords, CVAR_BOOL, 0, 0, 1 },
{ "cl_showfps", "cl_showfps: show the frame rate counter", (void*)&ud.tickrate, CVAR_BOOL, 0, 0, 1 },
{ "cl_smoothinput", "cl_smoothinput: enable/disable input smoothing\n", (void*)&SmoothInput, CVAR_BOOL, 0, 0, 1 },
{ "cl_weaponswitch", "cl_weaponswitch: enable/disable auto weapon switching", (void*)&ud.weaponswitch, CVAR_INT|256, 0, 0, 3 },

View file

@ -2843,24 +2843,43 @@ void getinput(short snum)
if( CONTROL_JoystickEnabled )
if ( running ) info.dz *= 2;
if( BUTTON(gamefunc_Strafe) ) {
svel = -(info.dyaw+lastinfo.dyaw)/8;
lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 8;
} else {
angvel = (info.dyaw+lastinfo.dyaw)/64;
lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 64;
}
if( myaimmode )
if(SmoothInput)
{
if(ud.mouseflip)
horiz = -(info.dz+lastinfo.dz)/(314-128);
else horiz = (info.dz+lastinfo.dz)/(314-128);
if( BUTTON(gamefunc_Strafe) ) {
svel = -(info.dyaw+lastinfo.dyaw)/8;
lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 8;
} else {
angvel = (info.dyaw+lastinfo.dyaw)/64;
lastinfo.dyaw = (lastinfo.dyaw+info.dyaw) % 64;
}
lastinfo.dz = (lastinfo.dz+info.dz) % (314-128);
info.dz = 0;
} else {
lastinfo.dz = info.dz % (1<<6);
if( myaimmode )
{
if(ud.mouseflip)
horiz = -(info.dz+lastinfo.dz)/(314-128);
else horiz = (info.dz+lastinfo.dz)/(314-128);
lastinfo.dz = (lastinfo.dz+info.dz) % (314-128);
info.dz = 0;
} else {
lastinfo.dz = info.dz % (1<<6);
}
}
else
{
if( BUTTON(gamefunc_Strafe) ) {
svel = -info.dyaw/8;
} else {
angvel = info.dyaw/64;
}
if( myaimmode )
{
if(ud.mouseflip)
horiz -= info.dz/(314-128);
else horiz += info.dz/(314-128);
info.dz = 0;
}
}
svel -= info.dx;

View file

@ -275,7 +275,7 @@ int xyzsound(short num,short i,long x,long y,long z)
{
if(VoiceToggle==0)
return -1;
else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && (!(gametype_flags[ud.coop]&GAMETYPE_FLAG_COOPSOUND)?1:VoiceToggle!=2))
else if (ud.multimode > 1 && PN == APLAYER && sprite[i].yvel != screenpeek && VoiceToggle!=2)
return -1;
for(j=0;j<NUM_SOUNDS;j++)
for(k=0;k<Sound[j].num;k++)