Moved modified HL SDK to trunk

This commit is contained in:
Scott Ehlert
2006-08-27 02:22:59 +00:00
parent 28c4ea4fec
commit 30235e05e5
900 changed files with 344676 additions and 0 deletions

View File

@ -0,0 +1,140 @@
# Microsoft Developer Studio Project File - Name="qlumpy" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=qlumpy - Win32 Release
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "qlumpy.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "qlumpy.mak" CFG="qlumpy - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "qlumpy - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "qlumpy - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""$/SDKSrc/Tools/utils/qlumpy", BVGBAAAA"
# PROP Scc_LocalPath "."
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "qlumpy - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir ".\Release"
# PROP BASE Intermediate_Dir ".\Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir ".\Release"
# PROP Intermediate_Dir ".\Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W2 /GX /O2 /I "..\..\common" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "qlumpy - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir ".\Debug"
# PROP BASE Intermediate_Dir ".\Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir ".\Debug"
# PROP Intermediate_Dir ".\Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
# ADD CPP /nologo /W2 /Gm /GX /ZI /Od /I "..\..\common" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /FR /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386
!ENDIF
# Begin Target
# Name "qlumpy - Win32 Release"
# Name "qlumpy - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
# Begin Source File
SOURCE=..\..\common\cmdlib.c
# End Source File
# Begin Source File
SOURCE=..\..\common\lbmlib.c
# End Source File
# Begin Source File
SOURCE=..\qlumpy.c
# End Source File
# Begin Source File
SOURCE=..\quakegrb.c
# End Source File
# Begin Source File
SOURCE=..\..\common\scriplib.c
# End Source File
# Begin Source File
SOURCE=..\..\common\wadlib.c
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
# Begin Source File
SOURCE=..\..\common\cmdlib.h
# End Source File
# Begin Source File
SOURCE=..\..\common\lbmlib.h
# End Source File
# Begin Source File
SOURCE=..\qlumpy.h
# End Source File
# Begin Source File
SOURCE=..\..\common\scriplib.h
# End Source File
# Begin Source File
SOURCE=..\..\common\wadlib.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

View File

@ -0,0 +1,37 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "qlumpy"=.\qlumpy.dsp - Package Owner=<4>
Package=<5>
{{{
begin source code control
"$/SDKSrc/Tools/utils/qlumpy", BVGBAAAA
.
end source code control
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
begin source code control
"$/SDKSrc/Tools/utils/qlumpy", BVGBAAAA
.
end source code control
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -0,0 +1,286 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="qlumpy"
ProjectGUID="{9309F40E-79AF-41A7-9572-06664DEF9FEF}"
SccProjectName="&quot;$/SDKSrc/Tools/utils/qlumpy&quot;, BVGBAAAA"
SccLocalPath=".">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\common"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="4"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Release/qlumpy.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="2"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/qlumpy.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/qlumpy.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/qlumpy.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\common"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
RuntimeLibrary="5"
UsePrecompiledHeader="2"
PrecompiledHeaderFile=".\Debug/qlumpy.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="2"
SuppressStartupBanner="TRUE"
DebugInformationFormat="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/qlumpy.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/qlumpy.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/qlumpy.tlb"
HeaderFileName=""/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90">
<File
RelativePath="..\..\common\cmdlib.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\common\lbmlib.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\qlumpy.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\quakegrb.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\common\scriplib.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\common\wadlib.c">
<FileConfiguration
Name="Release|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;fi;fd">
<File
RelativePath="..\..\common\cmdlib.h">
</File>
<File
RelativePath="..\..\common\lbmlib.h">
</File>
<File
RelativePath="..\qlumpy.h">
</File>
<File
RelativePath="..\..\common\scriplib.h">
</File>
<File
RelativePath="..\..\common\wadlib.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,386 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="qlumpy"
ProjectGUID="{9309F40E-79AF-41A7-9572-06664DEF9FEF}"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/qlumpy.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\common"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
StringPooling="true"
RuntimeLibrary="0"
EnableFunctionLevelLinking="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/qlumpy.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="2"
SuppressStartupBanner="true"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Release/qlumpy.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
ProgramDatabaseFile=".\Release/qlumpy.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/qlumpy.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\common"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/qlumpy.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="2"
SuppressStartupBanner="true"
DebugInformationFormat="3"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
OutputFile=".\Debug/qlumpy.exe"
LinkIncremental="1"
SuppressStartupBanner="true"
GenerateDebugInformation="true"
ProgramDatabaseFile=".\Debug/qlumpy.pdb"
SubSystem="1"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90"
>
<File
RelativePath="..\..\common\cmdlib.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\common\lbmlib.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\qlumpy.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\quakegrb.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\common\scriplib.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\common\wadlib.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="2"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=""
PreprocessorDefinitions=""
BrowseInformation="1"
/>
</FileConfiguration>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;fi;fd"
>
<File
RelativePath="..\..\common\cmdlib.h"
>
</File>
<File
RelativePath="..\..\common\lbmlib.h"
>
</File>
<File
RelativePath="..\qlumpy.h"
>
</File>
<File
RelativePath="..\..\common\scriplib.h"
>
</File>
<File
RelativePath="..\..\common\wadlib.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

430
hlsdk/utils/qlumpy/qlumpy.c Normal file
View File

@ -0,0 +1,430 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
****/
#define VERSION "2.2"
#include "qlumpy.h"
#define MAXLUMP 0x50000 // biggest possible lump
extern char qproject[];
int grabbed;
byte *byteimage, *lbmpalette;
int byteimagewidth, byteimageheight;
char basepath[1024];
char lumpname[16];
char destfile[1024];
byte *lumpbuffer, *lump_p;
qboolean savesingle;
qboolean outputcreated;
qboolean do16bit;
qboolean fTransparent255;
/*
=============================================================================
MAIN
=============================================================================
*/
void GrabRaw (void);
void GrabPalette (void);
void GrabPic (void);
void GrabMip (void);
void GrabColormap (void);
void GrabColormap2 (void);
void GrabFont( void );
typedef struct
{
char *name;
void (*function) (void);
} command_t;
command_t commands[] =
{
{ "palette", GrabPalette },
{ "colormap", GrabColormap },
{ "qpic", GrabPic },
{ "miptex", GrabMip },
{ "raw", GrabRaw },
{ "colormap2", GrabColormap2 },
{ "font", GrabFont },
{ NULL, NULL } // list terminator
};
#define TRANSPARENT_R 0x0
#define TRANSPARENT_G 0x0
#define TRANSPARENT_B 0xFF
#define IS_TRANSPARENT(p) (p[0]==TRANSPARENT_R && p[1]==TRANSPARENT_G && p[2]==TRANSPARENT_B)
/*
==============
TransparentByteImage
==============
*/
void TransparentByteImage( void )
{
// Remap all pixels of color 0,0,255 to index 255 and remap index 255 to something else
byte transtable[256], *image;
int i, j, firsttrans;
firsttrans = -1;
for ( i = 0; i < 256; i++ ) {
if ( IS_TRANSPARENT( (lbmpalette+(i*3)) ) ) {
transtable[i] = 255;
if ( firsttrans < 0 )
firsttrans = i;
}
else
transtable[i] = i;
}
// If there is some transparency, translate it
if ( firsttrans >= 0 ) {
if ( !IS_TRANSPARENT( (lbmpalette+(255*3)) ) )
transtable[255] = firsttrans;
image = byteimage;
for ( j = 0; j < byteimageheight; j++ ) {
for ( i = 0; i < byteimagewidth; i++ ) {
*image = transtable[*image];
image++;
}
}
// Move palette entry for pixels previously mapped to entry 255
lbmpalette[ firsttrans*3 + 0 ] = lbmpalette[ 255*3 + 0 ];
lbmpalette[ firsttrans*3 + 1 ] = lbmpalette[ 255*3 + 1 ];
lbmpalette[ firsttrans*3 + 2 ] = lbmpalette[ 255*3 + 2 ];
lbmpalette[ 255*3 + 0 ] = TRANSPARENT_R;
lbmpalette[ 255*3 + 1 ] = TRANSPARENT_G;
lbmpalette[ 255*3 + 2 ] = TRANSPARENT_B;
}
}
/*
==============
LoadScreen
==============
*/
void LoadScreen (char *name)
{
char *expanded;
expanded = ExpandPathAndArchive (name);
printf ("grabbing from %s...\n",expanded);
LoadLBM (expanded, &byteimage, &lbmpalette);
byteimagewidth = bmhd.w;
byteimageheight = bmhd.h;
}
/*
==============
LoadScreenBMP
==============
*/
void LoadScreenBMP(char *pszName)
{
char *pszExpanded;
char basename[64];
pszExpanded = ExpandPathAndArchive(pszName);
printf("grabbing from %s...\n", pszExpanded);
if (LoadBMP(pszExpanded, &byteimage, &lbmpalette))
Error ("Failed to load!", pszExpanded);
if ( byteimage == NULL || lbmpalette == NULL )
Error("FAIL!",pszExpanded);
byteimagewidth = bmhd.w;
byteimageheight = bmhd.h;
ExtractFileBase (token, basename); // Files that start with '$' have color (0,0,255) transparent,
if ( basename[0] == '{' ) { // move to last palette entry.
fTransparent255 = true;
TransparentByteImage();
}
}
/*
================
CreateOutput
================
*/
void CreateOutput (void)
{
outputcreated = true;
//
// create the output wadfile file
//
NewWad (destfile, false); // create a new wadfile
}
/*
===============
WriteLump
===============
*/
void WriteLump (int type, int compression)
{
int size;
if (!outputcreated)
CreateOutput ();
//
// dword align the size
//
while ((int)lump_p&3)
*lump_p++ = 0;
size = lump_p - lumpbuffer;
if (size > MAXLUMP)
Error ("Lump size exceeded %d, memory corrupted!",MAXLUMP);
//
// write the grabbed lump to the wadfile
//
AddLump (lumpname,lumpbuffer,size,type, compression);
}
/*
===========
WriteFile
Save as a seperate file instead of as a wadfile lump
===========
*/
void WriteFile (void)
{
char filename[1024];
char *exp;
sprintf (filename,"%s/%s.lmp", destfile, lumpname);
exp = ExpandPath(filename);
printf ("saved %s\n", exp);
SaveFile (exp, lumpbuffer, lump_p-lumpbuffer);
}
/*
================
ParseScript
================
*/
void ParseScript (void)
{
int cmd;
int size;
fTransparent255 = false;
do
{
//
// get a command / lump name
//
GetToken (true);
if (endofscript)
break;
if (!Q_strcasecmp (token,"$LOAD"))
{
GetToken (false);
LoadScreen (token);
continue;
}
if (!Q_strcasecmp (token,"$DEST"))
{
GetToken (false);
strcpy (destfile, token);
continue;
}
if (!Q_strcasecmp (token,"$SINGLEDEST"))
{
GetToken (false);
strcpy (destfile, token);
savesingle = true;
continue;
}
if (!Q_strcasecmp (token,"$LOADBMP"))
{
GetToken (false);
fTransparent255 = false;
LoadScreenBMP (token);
continue;
}
//
// new lump
//
if (strlen(token) >= sizeof(lumpname) )
Error ("\"%s\" is too long to be a lump name",token);
memset (lumpname,0,sizeof(lumpname));
strcpy (lumpname, token);
for (size=0 ; size<sizeof(lumpname) ; size++)
lumpname[size] = tolower(lumpname[size]);
//
// get the grab command
//
lump_p = lumpbuffer;
GetToken (false);
//
// call a routine to grab some data and put it in lumpbuffer
// with lump_p pointing after the last byte to be saved
//
for (cmd=0 ; commands[cmd].name ; cmd++)
if ( !Q_strcasecmp(token,commands[cmd].name) )
{
commands[cmd].function ();
break;
}
if ( !commands[cmd].name )
Error ("Unrecognized token '%s' at line %i",token,scriptline);
grabbed++;
if (savesingle)
WriteFile ();
else
WriteLump (TYP_LUMPY+cmd, 0);
} while (!endofscript);
}
/*
=================
ProcessLumpyScript
Loads a script file, then grabs everything from it
=================
*/
void ProcessLumpyScript (char *basename)
{
char script[256];
printf ("qlumpy script: %s\n",basename);
//
// create default destination directory
//
strcpy (destfile, ExpandPath(basename));
StripExtension (destfile);
strcat (destfile,".wad"); // unless the script overrides, save in cwd
//
// save in a wadfile by default
//
savesingle = false;
grabbed = 0;
outputcreated = false;
//
// read in the script file
//
strcpy (script, basename);
DefaultExtension (script, ".ls");
LoadScriptFile (script);
strcpy (basepath, basename);
ParseScript (); // execute load / grab commands
if (!savesingle)
{
WriteWad (do16bit); // write out the wad directory
printf ("%i lumps grabbed in a wad file\n",grabbed);
}
else
printf ("%i lumps written seperately\n",grabbed);
}
/*
==============================
main
==============================
*/
int main (int argc, char **argv)
{
int i;
printf ("\nqlumpy "VERSION" by John Carmack, copyright (c) 1994 Id Software.\n");
printf ("Portions copyright (c) 1998 Valve LLC (%s)\n", __DATE__ );
if (argc == 1)
Error ("qlumpy [-archive directory] [-8bit] [-proj <project>] scriptfile [scriptfile ...]");
lumpbuffer = malloc (MAXLUMP);
do16bit = true;
for( i=1; i<argc; i++ )
{
if( *argv[ i ] == '-' )
{
if( !strcmp( argv[ i ], "-archive" ) )
{
archive = true;
strcpy (archivedir, argv[2]);
printf ("Archiving source to: %s\n", archivedir);
}
else if( !strcmp( argv[ i ], "-proj" ) )
{
strcpy( qproject, argv[ i + 1 ] );
i++;
}
else if( !strcmp( argv[ i ], "-8bit" ) )
do16bit = false;
}
else
break;
}
// rest of arguments are script files
for ( ; i<argc ; i++)
{
char szTemp[1024];
char *pszPath = argv[i];
// Fully qualify the path names before using them
if (!(pszPath[0] == '/' || pszPath[0] == '\\' || pszPath[1] == ':'))
{ // path is partial
Q_getwd (szTemp);
strcat (szTemp, pszPath);
pszPath = szTemp;
}
SetQdirFromPath(pszPath);
ProcessLumpyScript(pszPath);
}
return 0;
}

View File

@ -0,0 +1,26 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
****/
#include "cmdlib.h"
#include "scriplib.h"
#include "lbmlib.h"
#include "wadlib.h"
extern byte *byteimage, *lbmpalette;
extern int byteimagewidth, byteimageheight;
#define SCRN(x,y) (*(byteimage+(y)*byteimagewidth+x))
extern byte *lump_p;
extern byte *lumpbuffer;
extern char lumpname[];

View File

@ -0,0 +1,841 @@
/***
*
* Copyright (c) 1996-2002, Valve LLC. All rights reserved.
*
* This product contains software technology licensed from Id
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
* All Rights Reserved.
*
****/
#include "qlumpy.h"
#include "math.h"
#pragma warning (disable : 4244)
typedef struct
{
short ofs, length;
} row_t;
typedef struct
{
int width, height;
int widthbits, heightbits;
unsigned char data[4];
} qtex_t;
typedef struct
{
int width, height;
byte data[4]; // variably sized
} qpic_t;
// Font stuff
#define NUM_GLYPHS 256
const unsigned kFontMarker = 254;
typedef struct
{
short startoffset;
short charwidth;
} charinfo;
typedef struct
{
int width, height;
int rowcount;
int rowheight;
charinfo fontinfo[ NUM_GLYPHS ];
byte data[4];
} qfont_t;
extern qboolean fTransparent255;
#define SCRN(x,y) (*(byteimage+(y)*byteimagewidth+x))
void GrabPalette16( void );
extern qboolean do16bit;
/*
==============
GrabRaw
filename RAW x y width height
==============
*/
void GrabRaw (void)
{
int x,y,xl,yl,xh,yh,w,h;
byte *screen_p;
int linedelta;
GetToken (false);
xl = atoi (token);
GetToken (false);
yl = atoi (token);
GetToken (false);
w = atoi (token);
GetToken (false);
h = atoi (token);
if (xl == -1)
{
xl = yl = 0;
w = byteimagewidth;
h = byteimageheight;
}
xh = xl+w;
yh = yl+h;
screen_p = byteimage + yl*byteimagewidth + xl;
linedelta = byteimagewidth - w;
for (y=yl ; y<yh ; y++)
{
for (x=xl ; x<xh ; x++)
{
*lump_p++ = *screen_p;
*screen_p++ = 0;
}
screen_p += linedelta;
}
}
/*
==============
GrabPalette
filename PALETTE [startcolor endcolor]
==============
*/
void GrabPalette (void)
{
int start, end, length;
if (TokenAvailable())
{
GetToken (false);
start = atoi (token);
GetToken (false);
end = atoi (token);
}
else
{
start = 0;
end = 255;
}
length = 3*(end-start+1);
memcpy (lump_p, lbmpalette+start*3, length);
lump_p += length;
}
/*
==============
GrabPic
filename qpic x y width height
==============
*/
void GrabPic (void)
{
int x,y,xl,yl,xh,yh;
int width;
qpic_t *header;
GetToken (false);
xl = atoi (token);
GetToken (false);
yl = atoi (token);
GetToken (false);
xh = xl+atoi (token);
GetToken (false);
yh = yl+atoi (token);
if (xl == -1)
{
xl = yl = 0;
xh = byteimagewidth;
yh = byteimageheight;
}
if (xh<xl || yh<yl || xl < 0 || yl<0) // || xh>319 || yh>239)
Error ("GrabPic: Bad size: %i, %i, %i, %i",xl,yl,xh,yh);
//
// fill in header
//
header = (qpic_t *)lump_p;
width = xh-xl;
header->width = LittleLong(width);
header->height = LittleLong(yh-yl);
//
// start grabbing posts
//
lump_p = (byte *)header->data;
for (y=yl ; y< yh ; y++)
for (x=xl ; x<xh ; x++)
*lump_p++ = SCRN(x,y);
// New for 16bpp display
if( do16bit )
GrabPalette16();
}
/*
=============================================================================
COLORMAP GRABBING
=============================================================================
*/
/*
===============
BestColor
===============
*/
byte BestColor (int r, int g, int b, int start, int stop)
{
int i;
int dr, dg, db;
int bestdistortion, distortion;
int bestcolor;
byte *pal;
//
// let any color go to 0 as a last resort
//
bestdistortion = ( (int)r*r + (int)g*g + (int)b*b )*2;
bestcolor = 0;
pal = lbmpalette + start*3;
for (i=start ; i<= stop ; i++)
{
dr = r - (int)pal[0];
dg = g - (int)pal[1];
db = b - (int)pal[2];
pal += 3;
distortion = dr*dr + dg*dg + db*db;
if (distortion < bestdistortion)
{
if (!distortion)
return i; // perfect match
bestdistortion = distortion;
bestcolor = i;
}
}
return bestcolor;
}
/*
==============
GrabColormap
filename COLORMAP levels fullbrights
the first map is an identiy 0-255
the final map is all black except for the fullbrights
the remaining maps are evenly spread
fullbright colors start at the top of the palette.
==============
*/
void GrabColormap (void)
{
int levels, brights;
int l, c;
float frac, red, green, blue;
GetToken (false);
levels = atoi (token);
GetToken (false);
brights = atoi (token);
// identity lump
for (l=0 ; l<256 ; l++)
*lump_p++ = l;
// shaded levels
for (l=1;l<levels;l++)
{
frac = 1.0 - (float)l/(levels-1);
for (c=0 ; c<256-brights ; c++)
{
red = lbmpalette[c*3];
green = lbmpalette[c*3+1];
blue = lbmpalette[c*3+2];
red = (int)(red*frac+0.5);
green = (int)(green*frac+0.5);
blue = (int)(blue*frac+0.5);
//
// note: 254 instead of 255 because 255 is the transparent color, and we
// don't want anything remapping to that
//
*lump_p++ = BestColor(red,green,blue, 0, 254);
}
for ( ; c<256 ; c++)
*lump_p++ = c;
}
*lump_p++ = brights;
}
/*
==============
GrabColormap2
experimental -- not used by quake
filename COLORMAP2 range levels fullbrights
fullbright colors start at the top of the palette.
Range can be greater than 1 to allow overbright color tables.
the first map is all 0
the last (levels-1) map is at range
==============
*/
void GrabColormap2 (void)
{
int levels, brights;
int l, c;
float frac, red, green, blue;
float range;
GetToken (false);
range = atof (token);
GetToken (false);
levels = atoi (token);
GetToken (false);
brights = atoi (token);
// shaded levels
for (l=0;l<levels;l++)
{
frac = range - range*(float)l/(levels-1);
for (c=0 ; c<256-brights ; c++)
{
red = lbmpalette[c*3];
green = lbmpalette[c*3+1];
blue = lbmpalette[c*3+2];
red = (int)(red*frac+0.5);
green = (int)(green*frac+0.5);
blue = (int)(blue*frac+0.5);
//
// note: 254 instead of 255 because 255 is the transparent color, and we
// don't want anything remapping to that
//
*lump_p++ = BestColor(red,green,blue, 0, 254);
}
// fullbrights allways stay the same
for ( ; c<256 ; c++)
*lump_p++ = c;
}
*lump_p++ = brights;
}
/*
=============================================================================
MIPTEX GRABBING
=============================================================================
*/
typedef struct
{
char name[16];
unsigned width, height;
unsigned offsets[4]; // four mip maps stored
} miptex_t;
byte pixdata[256];
float linearpalette[256][3];
float d_red, d_green, d_blue;
int colors_used;
int color_used[256];
float maxdistortion;
byte AddColor( float r, float g, float b )
{
int i;
for (i = 0; i < 255; i++)
{
if (!color_used[i])
{
linearpalette[i][0] = r;
linearpalette[i][1] = g;
linearpalette[i][2] = b;
if (r < 0) r = 0.0;
if (r > 1.0) r = 1.0;
lbmpalette[i*3+0] = pow( r, 1.0 / 2.2) * 255;
if (g < 0) g = 0.0;
if (g > 1.0) g = 1.0;
lbmpalette[i*3+1] = pow( g, 1.0 / 2.2) * 255;
if (b < 0) b = 0.0;
if (b > 1.0) b = 1.0;
lbmpalette[i*3+2] = pow( b, 1.0 / 2.2) * 255;
color_used[i] = 1;
colors_used++;
return i;
}
}
return 0;
}
/*
=============
AveragePixels
=============
*/
byte AveragePixels (int count)
{
float r,g,b;
int i;
int vis;
int pix;
float dr, dg, db;
float bestdistortion, distortion;
int bestcolor;
byte *pal;
vis = 0;
r = g = b = 0;
for (i=0 ; i<count ; i++)
{
pix = pixdata[i];
r += linearpalette[pix][0];
g += linearpalette[pix][1];
b += linearpalette[pix][2];
}
r /= count;
g /= count;
b /= count;
r += d_red;
g += d_green;
b += d_blue;
//
// find the best color
//
// bestdistortion = r*r + g*g + b*b;
bestdistortion = 3.0;
bestcolor = -1;
for ( i=0; i<255; i++)
{
if (color_used[i])
{
pix = i; //pixdata[i];
dr = r - linearpalette[i][0];
dg = g - linearpalette[i][1];
db = b - linearpalette[i][2];
distortion = dr*dr + dg*dg + db*db;
if (distortion < bestdistortion)
{
if (!distortion)
{
d_red = d_green = d_blue = 0; // no distortion yet
return pix; // perfect match
}
bestdistortion = distortion;
bestcolor = pix;
}
}
}
if (bestdistortion > 0.001 && colors_used < 255)
{
// printf("%f %f %f\n", r, g, b );
bestcolor = AddColor( r, g, b );
d_red = d_green = d_blue = 0;
bestdistortion = 0;
}
else
{
// error diffusion
d_red = r - linearpalette[bestcolor][0];
d_green = g - linearpalette[bestcolor][1];
d_blue = b - linearpalette[bestcolor][2];
}
if (bestdistortion > maxdistortion)
maxdistortion = bestdistortion;
return bestcolor;
}
/*
==============
GrabMip
filename MIP x y width height
must be multiples of sixteen
==============
*/
void GrabMip (void)
{
int i,j,x,y,xl,yl,xh,yh,w,h;
byte *screen_p, *source, testpixel;
int linedelta;
miptex_t *qtex;
int miplevel, mipstep;
int xx, yy, pix;
int count;
GetToken (false);
xl = atoi (token);
GetToken (false);
yl = atoi (token);
GetToken (false);
w = atoi (token);
GetToken (false);
h = atoi (token);
if (xl == -1)
{
xl = yl = 0;
w = byteimagewidth;
h = byteimageheight;
}
if ( (w & 15) || (h & 15) )
Error ("line %i: miptex sizes must be multiples of 16", scriptline);
xh = xl+w;
yh = yl+h;
qtex = (miptex_t *)lump_p;
qtex->width = LittleLong(w);
qtex->height = LittleLong(h);
strcpy (qtex->name, lumpname);
lump_p = (byte *)&qtex->offsets[4];
screen_p = byteimage + yl*byteimagewidth + xl;
linedelta = byteimagewidth - w;
source = lump_p;
qtex->offsets[0] = LittleLong(lump_p - (byte *)qtex);
for (y=yl ; y<yh ; y++)
{
for (x=xl ; x<xh ; x++)
{
pix = *screen_p;
*screen_p++ = 0;
// if (pix == 255)
// pix = 0;
*lump_p++ = pix;
}
screen_p += linedelta;
}
// calculate gamma corrected linear palette
for (i = 0; i < 256; i++)
{
for (j = 0; j < 3; j++)
{
float f;
f = lbmpalette[i*3+j] / 255.0;
linearpalette[i][j] = pow(f, 2.2 ); // assume textures are done at 2.2, we want to remap them at 1.0
}
}
maxdistortion = 0;
if (!fTransparent255)
{
// figure out what palette entries are actually used
colors_used = 0;
for (i = 0; i < 256; i++)
color_used[i] = 0;
for (x = 0; x < w; x++)
{
for (y = 0; y < h; y++)
{
if (!color_used[source[ y*w + x]])
{
color_used[source[ y*w + x]] = 1;
colors_used++;
}
}
}
}
else
{
// assume palette full if it's a transparent texture
colors_used = 256;
for (i = 0; i < 256; i++)
color_used[i] = 1;
}
// printf("colors_used %d : ", colors_used );
//
// subsample for greater mip levels
//
for (miplevel = 1 ; miplevel<4 ; miplevel++)
{
int pixTest;
d_red = d_green = d_blue = 0; // no distortion yet
qtex->offsets[miplevel] = LittleLong(lump_p - (byte *)qtex);
mipstep = 1<<miplevel;
pixTest = (int)( (float)(mipstep * mipstep) * 0.4 ); // 40% of pixels
for (y=0 ; y<h ; y+=mipstep)
{
for (x = 0 ; x<w ; x+= mipstep)
{
count = 0;
for (yy=0 ; yy<mipstep ; yy++)
for (xx=0 ; xx<mipstep ; xx++)
{
testpixel = source[ (y+yy)*w + x + xx ];
// If 255 is not transparent, or this isn't a transparent pixel, add it in to the image filter
if ( !fTransparent255 || testpixel != 255 ) {
pixdata[count] = testpixel;
count++;
}
}
if ( count <= pixTest ) // Solid pixels account for < 40% of this pixel, make it transparent
{
*lump_p++ = 255;
}
else
{
*lump_p++ = AveragePixels (count);
}
}
}
}
// printf(" %d %f\n", colors_used, maxdistortion );
if( do16bit )
GrabPalette16();
}
/*
=============================================================================
PALETTE GRABBING
=============================================================================
*/
void GrabPalette16( void )
{
int i;
// Write out palette in 16bit mode
*(unsigned short *) lump_p = 256; // palette size
lump_p += sizeof(short);
memcpy( lump_p, lbmpalette, 768 );
lump_p += 768;
}
/*
=============================================================================
FONT GRABBING
=============================================================================
*/
/*
==============
GrabFont
font x y width height startglyph
==============
*/
void GrabFont( void )
{
int x, y, y2, xl, x2, yl, xh, yh, i, j;
int index, offset;
int width;
int iCurX; // current x in destination
int iMaxX; // max x in destination
byte *pbuf, *pCur;
qfont_t *header;
iMaxX = 255;
iCurX = 0;
// Set up header
header = (qfont_t *)lump_p;
memset( header, 0, sizeof(qfont_t) );
GetToken( false );
header->width = header->rowheight = atoi( token ); //mwh why does width equal rowheight?
header->height = 1;
lump_p = (byte *)header->data;
pCur = (byte *)lump_p;
memset( lump_p, 0xFF, 256 * 160);
GetToken( false );
index = atoi( token );
while( index != -1 )
{
// Get/Process source bitmap coordinates
GetToken (false);
xl = atoi (token);
GetToken (false);
yl = atoi (token);
GetToken (false);
xh = xl-1+atoi (token);
GetToken (false);
yh = atoi (token) - 1;
if (xl == -1)
{
xl = yl = 0;
xh = byteimagewidth;
yh = byteimageheight;
}
if( xh<xl || yh<yl || xl < 0 || yl<0 )
Error( "GrabFont line %1: Bad size: %i, %i, %i, %i", scriptline, xl, yl, xh, yh );
//
// Fill in font information
// Create a bitmap that is up to 256 wide and as tall as we need to accomadate the font.
// We limit the bitmap to 256 because some 3d boards have problems with textures bigger
// than that.
//
for( y=yl; y<yh; y+=header->rowheight+1 )
{
// Make sure we're at a marker
if( y != yl )
{
for( y2=y-header->rowheight; y2<yh; y2++ )
if( kFontMarker == (unsigned) SCRN(xl,y2) )
break;
if( y2 == yh )
break;
else if( y2 != y )
Error( "GrabFont line %d: rowheight doesn't seem to match bitmap (%d, %d)\n", scriptline, y, y2 );
}
for( x=xl; x<xh; )
{
// find next marker
for( x2=x+1; x2<xh; x2++ )
if( kFontMarker == (unsigned) SCRN(x2,y) )
break;
// check for end of row
if( x2 == xh )
break;
// Set up glyph information
if( index >= NUM_GLYPHS )
{
printf( "GrabFont: Glyph out of range\n" );
goto getout;
}
// Fill in glyph info
header->fontinfo[ index ].charwidth = x2 - x - 1;
// update header
// output glyph data
iCurX += header->fontinfo[index].charwidth;
// Will this glyph fit on this row?
if (iCurX >= iMaxX)
{
// Nope -- move to next row
pCur = (byte *)lump_p + 256 * header->rowheight * header->height;
header->height++;
iCurX = header->fontinfo[index].charwidth;
}
// copy over the glyph bytes
pbuf = pCur;
header->fontinfo[ index ].startoffset = pCur - (byte *) header->data;
for(j = 1; j <= header->rowheight; j++)
{
byte *psrc = byteimage + (y + j) * byteimagewidth + (x + 1);
for(i = x + 1; i < x2; i++)
*pbuf++ = *psrc++;
pbuf = pCur + j * 256;
}
// move the lump pointer to point at the next possible glyph
pCur += header->fontinfo[index].charwidth;
x = x2;
index++;
}
}
// Get next ASCII index
getout:
GetToken (false);
index = atoi (token);
}
// advance the lump pointer so that the last row is saved.
lump_p += (256 * header->rowheight) * header->height;
// JAY: Round up to the next power of 2 for GL
offset = header->height * header->rowheight;
y = (offset>128)?256:(offset>64)?128:(offset>32)?64:(offset>16)?32:16;
if ( offset != y )
{
printf("Rounding font from 256x%d to 256x%d\n", offset, y );
lump_p += (256 * (y - offset));
}
header->rowcount = header->height;
header->height = y;
if( do16bit )
GrabPalette16();
}