* Turn several constants into "static const <type>" variables

* Move these constants in the smallest scope where they're used
 * Fix a "comparison between signed and unsigned" warning
 * Move a variable into a more local scope

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6169 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-10-15 17:48:46 +00:00
parent bf1e1fef77
commit bc5396e8ed
1 changed files with 7 additions and 8 deletions

View File

@ -449,17 +449,13 @@ BOOL seq_StopFullScreenVideo(void)
return true;
}
#define FOLLOW_ON_JUSTIFICATION 160 // not really used for anything
#define MIN_JUSTIFICATION 40
// add a string at x,y or add string below last line if x and y are 0
BOOL seq_AddTextForVideo(const char* pText, SDWORD xOffset, SDWORD yOffset, SDWORD startFrame, SDWORD endFrame, SEQ_TEXT_POSITIONING textJustification)
{
SDWORD sourceLength, currentLength;
char* currentText;
SDWORD justification;
static SDWORD lastX;
int BUFFER_WIDTH = pie_GetVideoBufferWidth();
const unsigned int BUFFER_WIDTH = pie_GetVideoBufferWidth();
iV_SetFont(font_regular);
@ -486,7 +482,7 @@ BOOL seq_AddTextForVideo(const char* pText, SDWORD xOffset, SDWORD yOffset, SDWO
//check the string is shortenough to print
//if not take a word of the end and try again
while(iV_GetTextWidth(currentText) > BUFFER_WIDTH)
while (iV_GetTextWidth(currentText) > BUFFER_WIDTH)
{
currentLength--;
while((pText[currentLength] != ' ') && (currentLength > 0))
@ -515,12 +511,15 @@ BOOL seq_AddTextForVideo(const char* pText, SDWORD xOffset, SDWORD yOffset, SDWO
if (textJustification
&& currentLength == sourceLength)
{
static const int MIN_JUSTIFICATION = 40;
static const int FOLLOW_ON_JUSTIFICATION = 160;
//justify this text
justification = BUFFER_WIDTH - iV_GetTextWidth(currentText);
const int justification = BUFFER_WIDTH - iV_GetTextWidth(currentText);
if (textJustification == SEQ_TEXT_JUSTIFY
&& justification > MIN_JUSTIFICATION)
{
aSeqList[currentSeq].aText[aSeqList[currentSeq].currentText].x += (justification/2);
aSeqList[currentSeq].aText[aSeqList[currentSeq].currentText].x += (justification / 2);
}
else if (textJustification == SEQ_TEXT_FOLLOW_ON
&& justification > FOLLOW_ON_JUSTIFICATION)