Comments, cleanups.

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2457 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-10-26 00:35:33 +00:00
parent 50fb273229
commit fcaf2c3b7e
+34 -37
View File
@@ -305,6 +305,9 @@ add_text (int status, PTEXT pTextIn)
else else
{ {
// Alien speech // Alien speech
// Draw the background by drawing the same text in the
// background color one pixel shifted to all 4 directions.
SetContextForeGroundColor (CommData.AlienTextBColor); SetContextForeGroundColor (CommData.AlienTextBColor);
--pText->baseline.x; --pText->baseline.x;
@@ -334,7 +337,7 @@ add_text (int status, PTEXT pTextIn)
{ {
STAMP s; STAMP s;
// we were drawing to cache -- flush to screen // We were drawing to cache -- flush to screen
SetContext (OldContext); SetContext (OldContext);
s.origin.x = s.origin.y = 0; s.origin.x = s.origin.y = 0;
s.frame = TextCacheFrame; s.frame = TextCacheFrame;
@@ -352,13 +355,15 @@ add_text (int status, PTEXT pTextIn)
// pText is the text to be fitted. pText->CharCount will be set to the // pText is the text to be fitted. pText->CharCount will be set to the
// number of characters that fitted. // number of characters that fitted.
// startNext will be filled with the start of the first word that // startNext will be filled with the start of the first word that
// doesn't fit in one line. // doesn't fit in one line, or if an entire line fitted, to the character
// past the newline, or if the entire string fitted, to the end of the
// string.
// maxWidth is the maximum number of pixels that a line may be wide // maxWidth is the maximum number of pixels that a line may be wide
// maxChars is the maximum number of characters (not bytes) that are to // maxChars is the maximum number of characters (not bytes) that are to
// be fitted. // be fitted.
// TRUE is returned if a complete line fitted // TRUE is returned if a complete line fitted
// FALSE otherwise // FALSE otherwise
static BOOLEAN BOOLEAN
getLineWithinWidth(TEXT *pText, const unsigned char **startNext, getLineWithinWidth(TEXT *pText, const unsigned char **startNext,
SIZE maxWidth, COUNT maxChars) { SIZE maxWidth, COUNT maxChars) {
BOOLEAN eol; BOOLEAN eol;
@@ -650,14 +655,10 @@ SetUpSequence (PSEQUENCE pSeq)
pSeq->FramesLeft = ADPtr->NumFrames; pSeq->FramesLeft = ADPtr->NumFrames;
if (pSeq->AnimType == COLOR_ANIM) if (pSeq->AnimType == COLOR_ANIM)
pSeq->AnimObj.CurCMap = SetAbsColorMapIndex ( pSeq->AnimObj.CurCMap = SetAbsColorMapIndex (
CommData.AlienColorMap, CommData.AlienColorMap, ADPtr->StartIndex);
ADPtr->StartIndex
);
else else
pSeq->AnimObj.CurFrame = SetAbsFrameIndex ( pSeq->AnimObj.CurFrame = SetAbsFrameIndex (
CommData.AlienFrame, CommData.AlienFrame, ADPtr->StartIndex);
ADPtr->StartIndex
);
if (ADPtr->AnimFlags & RANDOM_ANIM) if (ADPtr->AnimFlags & RANDOM_ANIM)
{ {
@@ -681,11 +682,8 @@ SetUpSequence (PSEQUENCE pSeq)
IncFrameIndex (pSeq->AnimObj.CurFrame); IncFrameIndex (pSeq->AnimObj.CurFrame);
} }
pSeq->Alarm = pSeq->Alarm = ADPtr->BaseRestartRate
ADPtr->BaseRestartRate + ((COUNT)TFB_Random () % (ADPtr->RandomRestartRate + 1)) + 1;
+ ((COUNT)TFB_Random ()
% (ADPtr->RandomRestartRate + 1))
+ 1;
} }
} }
@@ -864,18 +862,15 @@ ambient_anim_task (void *data)
if (ADPtr->AnimFlags & RANDOM_ANIM) if (ADPtr->AnimFlags & RANDOM_ANIM)
{ {
COUNT nextIndex = ADPtr->StartIndex +
(TFB_Random () % ADPtr->NumFrames);
if (pSeq->AnimType == COLOR_ANIM) if (pSeq->AnimType == COLOR_ANIM)
pSeq->AnimObj.CurCMap = pSeq->AnimObj.CurCMap = SetAbsColorMapIndex (
SetAbsColorMapIndex (pSeq->AnimObj.CurCMap, pSeq->AnimObj.CurCMap, nextIndex);
(COUNT) (ADPtr->StartIndex
+ ((COUNT)TFB_Random ()
% ADPtr->NumFrames)));
else else
pSeq->AnimObj.CurFrame = pSeq->AnimObj.CurFrame = SetAbsFrameIndex (
SetAbsFrameIndex (pSeq->AnimObj.CurFrame, pSeq->AnimObj.CurFrame, nextIndex);
(COUNT) (ADPtr->StartIndex
+ ((COUNT)TFB_Random ()
% ADPtr->NumFrames)));
} }
else if (pSeq->AnimType == COLOR_ANIM) else if (pSeq->AnimType == COLOR_ANIM)
{ {
@@ -963,8 +958,7 @@ ambient_anim_task (void *data)
(COUNT) (ADPtr->StartIndex + 1 (COUNT) (ADPtr->StartIndex + 1
+ ((COUNT)TFB_Random () + ((COUNT)TFB_Random ()
% (ADPtr->NumFrames - 1)))); % (ADPtr->NumFrames - 1))));
FrameRate += FrameRate += ADPtr->BaseRestartRate
ADPtr->BaseRestartRate
+ ((COUNT)TFB_Random () + ((COUNT)TFB_Random ()
% (ADPtr->RandomRestartRate + 1)); % (ADPtr->RandomRestartRate + 1));
} }
@@ -1012,7 +1006,8 @@ ambient_anim_task (void *data)
- ADPtr->StartIndex + 1) == - ADPtr->StartIndex + 1) ==
ADPtr->NumFrames) ADPtr->NumFrames)
{ {
CommData.AlienTalkDesc.AnimFlags &= ~TALK_INTRO; CommData.AlienTalkDesc.AnimFlags &=
~TALK_INTRO;
TransitionDone = TRUE; TransitionDone = TRUE;
} }
TransitionFrame = TalkFrame; TransitionFrame = TalkFrame;
@@ -1035,7 +1030,8 @@ ambient_anim_task (void *data)
CommData.AlienTalkDesc.AnimFlags &= CommData.AlienTalkDesc.AnimFlags &=
~(PAUSE_TALKING | TALK_DONE); ~(PAUSE_TALKING | TALK_DONE);
if (ADPtr->AnimFlags & TALK_INTRO) if (ADPtr->AnimFlags & TALK_INTRO)
CommData.AlienTalkDesc.AnimFlags &= ~WAIT_TALKING; CommData.AlienTalkDesc.AnimFlags &=
~WAIT_TALKING;
else else
{ {
ADPtr->AnimFlags |= PAUSE_TALKING; ADPtr->AnimFlags |= PAUSE_TALKING;
@@ -1130,6 +1126,7 @@ ambient_anim_task (void *data)
if (optSubtitles && CheckSub && sub_state >= SPACE_SUBTITLE) if (optSubtitles && CheckSub && sub_state >= SPACE_SUBTITLE)
{ {
// Redraw the subtitles.
TEXT t; TEXT t;
t = CommData.AlienTextTemplate; t = CommData.AlienTextTemplate;
@@ -1166,11 +1163,13 @@ SpewPhrases (COUNT wait_track)
F = CommData.AlienFrame; F = CommData.AlienFrame;
if (wait_track == 0) if (wait_track == 0)
{ {
wait_track = which_track = (COUNT)~0; wait_track = (COUNT)~0;
which_track = (COUNT)~0;
goto Rewind; goto Rewind;
} }
if (!(which_track = PlayingTrack ())) which_track = PlayingTrack ();
if (which_track == 0)
{ {
// initial start of player // initial start of player
if (wait_track == 1 || wait_track == (COUNT)~0) if (wait_track == 1 || wait_track == (COUNT)~0)
@@ -1277,8 +1276,7 @@ Rewind:
} }
ContinuityBreak = FALSE; ContinuityBreak = FALSE;
} }
else if (which_track == wait_track else if (which_track == wait_track || wait_track == (COUNT)~0)
|| wait_track == (COUNT)~0)
CommData.AlienFrame = F; CommData.AlienFrame = F;
} }
} while (ContinuityBreak } while (ContinuityBreak
@@ -2141,6 +2139,7 @@ RaceCommunication (void)
if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE) if (LOBYTE (GLOBAL (CurrentActivity)) == IN_LAST_BATTLE)
{ {
/* Going into talking pet conversation */
ReinitQueue (&GLOBAL (npc_built_ship_q)); ReinitQueue (&GLOBAL (npc_built_ship_q));
CloneShipFragment (SAMATRA_SHIP, &GLOBAL (npc_built_ship_q), 0); CloneShipFragment (SAMATRA_SHIP, &GLOBAL (npc_built_ship_q), 0);
InitCommunication (TALKING_PET_CONVERSATION); InitCommunication (TALKING_PET_CONVERSATION);
@@ -2151,7 +2150,6 @@ RaceCommunication (void)
} }
return; return;
} }
/* going into talking pet conversation */
else if (NextActivity & CHECK_LOAD) else if (NextActivity & CHECK_LOAD)
{ {
BYTE ec; BYTE ec;
@@ -2162,7 +2160,8 @@ RaceCommunication (void)
InitCommunication (SPATHI_CONVERSATION); InitCommunication (SPATHI_CONVERSATION);
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == 0) else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) == 0)
InitCommunication (TALKING_PET_CONVERSATION); InitCommunication (TALKING_PET_CONVERSATION);
else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) & ((1 << 4) | (1 << 5))) else if (GET_GAME_STATE (GLOBAL_FLAGS_AND_DATA) &
((1 << 4) | (1 << 5)))
// Communicate with the Ilwrath using a Hyperwave Broadcaster. // Communicate with the Ilwrath using a Hyperwave Broadcaster.
InitCommunication (ILWRATH_CONVERSATION); InitCommunication (ILWRATH_CONVERSATION);
else else
@@ -2237,9 +2236,7 @@ RaceCommunication (void)
BYTE i, NumShips; BYTE i, NumShips;
NumShips = (BYTE)CountLinks (&GLOBAL (npc_built_ship_q)); NumShips = (BYTE)CountLinks (&GLOBAL (npc_built_ship_q));
pESD->Index = MAKE_BYTE ( pESD->Index = MAKE_BYTE (NumShips, HINIBBLE (pESD->Index));
NumShips, HINIBBLE (pESD->Index)
);
pESD->Index |= ENCOUNTER_REFORMING; pESD->Index |= ENCOUNTER_REFORMING;
if (status == 0) if (status == 0)
pESD->Index |= ONE_SHOT_ENCOUNTER; pESD->Index |= ONE_SHOT_ENCOUNTER;