예제 #1
0
파일: s_misc.c 프로젝트: klamonte/maximus
int Make_Pth(char *value)
{
  int x=0;

  char temp[MAX_LINE],
       *s;

  if (value==NULL)
    s="";
  else s=value;

  while (*s && (s[x=strlen(s)-1]==' ' || s[x]=='\t'))
    s[x]='\0';

  if (*s && s[x] != PATH_DELIM)
  {
    s[++x]=PATH_DELIM;
    s[++x]='\0';
  }

  strcpy(temp,s);
  Add_Path(temp,1);

  return (Add_To_Heap(temp,TRUE));
}
예제 #2
0
/*-------------------------------------------------------------------
    Procedure   :   Load All Offset Files
    Input       :   Nothing
    Output      :   BOOL    True/False
-------------------------------------------------------------------*/
BOOL Load_All_Off_Files( OFF_FILES * FileInfo )
{
    int8            TempFilename[ 256 ];
    int8        *   OffsetPath = "data\\offsets\\";
    int16           last_tpage;

    AddCommentToBat( "Offsets" );

    if( !FileInfo ) return( FALSE );

    EnableRelevantOffFiles( FileInfo );

    if( bPolyText )
    {
        strcpy( &FontFile[ 0 ], Font512File );
    }
    else
    {
        FontFile[ 0 ] = 0;
        Text512_Header = NULL;
    }

    if( d3dappi.szClient.cx >= 512 && d3dappi.szClient.cy >= 384 )
    {
        strcpy ( &TitleFontFile[ 0 ], VduFont512 );
        VduScaleX = (float)d3dappi.szClient.cx / 512.0F;
        VduScaleY = (float)d3dappi.szClient.cy / 384.0F;
    }else
    {
        strcpy ( &TitleFontFile[ 0 ], VduFont320 );
        VduScaleX = (float)d3dappi.szClient.cx / 320.0F;
        VduScaleY = (float)d3dappi.szClient.cy / 200.0F;
    }

    VduScaleX = (float)floor((double)VduScaleX);
    VduScaleY = (float)floor((double)VduScaleY);
    
    if (!CanDoStrechBlt)
    {
        VduScaleX = 1.0F; VduScaleY = 1.0F;
    }

/*
    VduScaleX = 1.0F; VduScaleY = 1.0F;
    switch ( ModeCase )
    {
    case Mode320X200:
        strcpy ( &TitleFontFile[ 0 ], VduFont320 );
        VduScaleX = 1.0F; VduScaleY = 1.0F;
        break;
    case Mode320X240:
        strcpy ( &TitleFontFile[ 0 ], VduFont320 );
        VduScaleX = 1.0F; VduScaleY = 1.2F;
        break;
    case Mode320X400:
    case Mode800X600:
        strcpy ( &TitleFontFile[ 0 ], VduFont512 );
        VduScaleX = 1.5625F; VduScaleY = 1.5625F;
        strcpy ( &TitleFontFile[ 0 ], VduFont320 );
        VduScaleX = 1.0F; VduScaleY = 2.0F;
        break;
    case Mode512X384:
        strcpy ( &TitleFontFile[ 0 ], VduFont512 );
        VduScaleX = 1.0F; VduScaleY = 1.0F;
        break;
    case Mode640X400:
        strcpy ( &TitleFontFile[ 0 ], VduFont512 );
        VduScaleX = 1.25F; VduScaleY = 1.04F;
        break;
    case Mode640X480:
        strcpy ( &TitleFontFile[ 0 ], VduFont512 );
        VduScaleX = 1.25F; VduScaleY = 1.25F;
        break;
    case Mode1024X768:
        strcpy ( &TitleFontFile[ 0 ], VduFont512 );
        VduScaleX = 2.0F; VduScaleY = 2.0F;
        break;
    default:
        strcpy ( &TitleFontFile[ 0 ], VduFont320 );
        VduScaleX = 1.0F; VduScaleY = 1.0F;
        break;
    }
*/

    last_tpage = 0;

    while (!( FileInfo->LoadTPages & LOAD_TPAGES_FINISH ) )
    {
        if( FileInfo->LoadEnable )
        {
            if ( strcmp(&FileInfo->Filename[ 0 ], &TitleFontFile[ 0 ] ) == 0 )
            {
                if ( !( bPolyText && PolyText[MyGameStatus] ) )
                    FileInfo->LoadTPages = DONTLOAD_TPAGES;
                else
                    FileInfo->LoadTPages = LOAD_TPAGES_VIDMEM;
            }

            if ( ( !FileInfo->Filename[0] ) && (!( FileInfo->LoadTPages & LOAD_TPAGES_PLACEHOLDER ) ) )
            {
                FileInfo++;
                continue;
            }

            Add_Path( OffsetPath, FileInfo->Filename, &TempFilename[ 0 ] );
            AddFileToBat( &TempFilename[ 0 ] );

            *FileInfo->InfoPtrAddr = Load_Off_File( &TempFilename[ 0 ], FileInfo->Scale, FileInfo->LoadTPages, &last_tpage, FileInfo->xsize, FileInfo->ysize, ( FileInfo->LoadTPages & LOAD_TPAGES_PLACEHOLDER ) );
            if( *FileInfo->InfoPtrAddr == NULL )
            {
                Msg( "offset file missing or too many tpages\n%s\n", &TempFilename[ 0 ] );
                return FALSE;
            }
        }
        FileInfo++;
    }

    return TRUE;
}