From d764520616d38ac5380e0809fff116b2a977530e Mon Sep 17 00:00:00 2001 From: avolkov Date: Wed, 5 Oct 2005 20:22:25 +0000 Subject: [PATCH] Lowering the comm ambient animation rate from max of 120fps to highest known stable rate of 40 git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1886 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/comm.c | 16 ++++++++++++++-- sc2/src/sc2code/libs/timelib.h | 6 ++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/sc2/src/sc2code/comm.c b/sc2/src/sc2code/comm.c index eb3ccc49a..b80558afe 100644 --- a/sc2/src/sc2code/comm.c +++ b/sc2/src/sc2code/comm.c @@ -42,6 +42,18 @@ #include +// Maximum ambient animation frame rate (actual execution rate) +// A gfx frame is not always produced during an execution frame, +// and several animations are combined into one gfx frame. +// The rate was originally 120fps which allowed for more animation +// precision which is ultimately wasted on the human eye anyway. +// The highest known stable animation rate is 40fps, so that's what we use. +#define AMBIENT_ANIM_RATE 40 + +// Oscilloscope frame rate +// Should be <= AMBIENT_ANIM_RATE +// XXX: was 32 picked experimentally? +#define OSCILLOSCOPE_RATE 32 static void init_xform_control (void); static void uninit_xform_control (void); @@ -885,7 +897,7 @@ ambient_anim_task (void *data) BOOLEAN Change, CanTalk; DWORD CurTime, ElapsedTicks; - SleepThreadUntil (LastTime + ONE_SECOND / 120); + SleepThreadUntil (LastTime + ONE_SECOND / AMBIENT_ANIM_RATE); LockMutex (GraphicsLock); BatchGraphics (); @@ -1267,7 +1279,7 @@ ambient_anim_task (void *data) SetContext (OldContext); } - if (LastOscillTime + (ONE_SECOND / 32) < CurTime) + if (LastOscillTime + (ONE_SECOND / OSCILLOSCOPE_RATE) < CurTime) { LastOscillTime = CurTime; UpdateSpeechGraphics (FALSE); diff --git a/sc2/src/sc2code/libs/timelib.h b/sc2/src/sc2code/libs/timelib.h index 9ac81784a..c48b2fe6c 100644 --- a/sc2/src/sc2code/libs/timelib.h +++ b/sc2/src/sc2code/libs/timelib.h @@ -23,8 +23,10 @@ /* ONE_SECOND is the LCM of all the fractions of a second the game uses. * Battle is 24 FPS, Landers are 35 FPS, most UI-level things are 15 FPS, - * The Interplanetary flight is 30 FPS. Thus, the minimum value for - * ONE_SECOND is 840. */ + * The Interplanetary flight is 30 FPS, Comm ambient animation is 40 FPS, + * (also Comm Oscilloscope is 32 FPS, but it does not require a stable + * timer and currently runs within the Comm ambient anim paradigm anyway) + * Thus, the minimum value for ONE_SECOND is 840. */ #if TIMELIB == SDL # define ONE_SECOND 840 #endif