using global variable for sp-mouselook to save CPU usage

This commit is contained in:
zicodxx 2006-10-21 09:23:39 +00:00
parent dcd1b3d683
commit e4b7678261
2 changed files with 8 additions and 1 deletions

View file

@ -310,6 +310,7 @@ void show_commandline_help()
extern fix fixed_frametime;
extern int framerate_on;
extern void vfx_set_palette_sub(ubyte *);
extern int mouselook;
int Inferno_verbose = 0;
int start_net_immediately = 0;
@ -420,6 +421,11 @@ int main(int argc,char **argv)
if(FindArg( "-fastext" ))
extfaster=1;
if (FindArg("-mouselook"))
mouselook=1;
else
mouselook=0;
if ( FindArg( "-fps" ))
framerate_on = 1;

View file

@ -96,6 +96,7 @@ fix Cruise_speed=0;
int Allow_primary_cycle=1;
int Allow_secondary_cycle=1;
int mouselook=0;
#define BT_KEY 0
#define BT_MOUSE_BUTTON 1
@ -2454,7 +2455,7 @@ if (!Player_is_dead)
mprintf( (1, "Bogus frame time of %.2f seconds\n", f2fl(FrameTime) ));
// ZICO - remove clamp for pitch and heading if mouselook on and no multiplayer game
if ((Config_control_type != 5) || !(i=FindArg("-mouselook")) || (Game_mode & GM_MULTI) ) {
if ((Config_control_type != 5) || !mouselook || (Game_mode & GM_MULTI) ) {
if (Controls.pitch_time > FrameTime/2 ) Controls.pitch_time = FrameTime/2;
if (Controls.heading_time > FrameTime ) Controls.heading_time = FrameTime;
if (Controls.pitch_time < -FrameTime/2 ) Controls.pitch_time = -FrameTime/2;