Partial fix for bug #772; dropping strobe rate from unrealistic 60fps

to a human 15fps; code cleanup and strobe length independent from rate.

The rate used to be determined by SleepThread(1) which really meant
"as fast as possible" (the '1' got converted to 'ONE_SECOND/120' during
the ONE_SECOND patches). The "possible" part is not the same it was
11 years ago ;). The new 15fps rate was determined experimentally --
adjust as needed.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1935 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2005-10-31 16:29:42 +00:00
parent eb0e2e6839
commit 3336e61318
+23 -28
View File
@@ -22,7 +22,6 @@
#include "build.h"
static LOCDATA talkpet_desc =
{
NULL_PTR, /* init_encounter_func */
@@ -192,7 +191,9 @@ static LOCDATA talkpet_desc =
{ {0, 0}, 0, 0, 0, 0 }, /* AlienTextTemplate - starts blank */
};
#define NUM_STROBES 10
#define STROBE_RATE 15
#define STROBE_LENGTH (ONE_SECOND * 3 / 2)
#define NUM_STROBES (STROBE_LENGTH * STROBE_RATE / ONE_SECOND)
static void
ExitConversation (RESPONSE_REF R)
@@ -257,9 +258,26 @@ MindFuckUrquan (RESPONSE_REF R)
static void PetDevice (RESPONSE_REF R);
static void
MindControl (RESPONSE_REF R)
MindControlStrobe (void)
{
BYTE i;
for (i = 0; i < NUM_STROBES; ++i)
{
XFormPLUT (GetColorMapAddress (
SetAbsColorMapIndex (CommData.AlienColorMap, 1)
), 0);
SleepThread (ONE_SECOND / (STROBE_RATE * 2));
XFormPLUT (GetColorMapAddress (
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
), 0);
SleepThread (ONE_SECOND / (STROBE_RATE * 2));
}
}
static void
MindControl (RESPONSE_REF R)
{
RESPONSE_FUNC RespFunc;
if (PLAYER_SAID (R, what_about_powers))
@@ -278,18 +296,7 @@ RESPONSE_FUNC RespFunc;
}
AlienTalkSegue ((COUNT)~0);
for (i = 0; i < NUM_STROBES; ++i)
{
XFormPLUT (GetColorMapAddress (
SetAbsColorMapIndex (CommData.AlienColorMap, 1)
), 0);
SleepThread (ONE_SECOND / 120);
XFormPLUT (GetColorMapAddress (
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
), 0);
SleepThread (ONE_SECOND / 120);
}
MindControlStrobe ();
Response (R, RespFunc);
}
@@ -547,22 +554,10 @@ KillPet (RESPONSE_REF R)
{
if (PLAYER_SAID (R, must_kill))
{
BYTE i;
NPCPhrase (DONT_KILL);
AlienTalkSegue ((COUNT)~0);
for (i = 0; i < NUM_STROBES; ++i)
{
XFormPLUT (GetColorMapAddress (
SetAbsColorMapIndex (CommData.AlienColorMap, 1)
), 0);
SleepThread (ONE_SECOND / 120);
XFormPLUT (GetColorMapAddress (
SetAbsColorMapIndex (CommData.AlienColorMap, 0)
), 0);
SleepThread (ONE_SECOND / 120);
}
MindControlStrobe ();
}
Response (want_kill_1, ExitConversation);