From 1601168c8d9bd0970ce55edd3beec3aba9a3f8dc Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Fri, 7 Nov 2003 20:53:42 +0000 Subject: [PATCH] move RageTextureID into its own file --- stepmania/src/RageTexture.cpp | 72 ------------------------- stepmania/src/RageTexture.h | 27 +--------- stepmania/src/RageTextureID.cpp | 75 ++++++++++++++++++++++++++ stepmania/src/RageTextureID.h | 30 +++++++++++ stepmania/src/StepMania.dsp | 95 ++++++++++++++++++--------------- stepmania/src/StepMania.vcproj | 6 +++ 6 files changed, 165 insertions(+), 140 deletions(-) create mode 100644 stepmania/src/RageTextureID.cpp create mode 100644 stepmania/src/RageTextureID.h diff --git a/stepmania/src/RageTexture.cpp b/stepmania/src/RageTexture.cpp index 801d9a0e94..d4f223aaa3 100644 --- a/stepmania/src/RageTexture.cpp +++ b/stepmania/src/RageTexture.cpp @@ -14,78 +14,6 @@ #include "RageTextureManager.h" #include -void RageTextureID::Init() -{ - /* Maximum size of the texture, per dimension. */ - iMaxSize = 2048; - - /* Number of mipmaps. (unimplemented) */ - iMipMaps = 4; - - /* Maximum number of bits for alpha. In 16-bit modes, lowering - * this gives more bits for color values. (0, 1 or 4) */ - iAlphaBits = 4; - - /* If this is greater than -1, then the image will be loaded as a luma/alpha - * map, eg. I4A4. At most 8 bits per pixel will be used This only actually happens - * when paletted textures are supported. - * - * If the sum of alpha and grayscale bits is <= 4, and the system supports 4-bit - * palettes, then the image will be loaded with 4bpp. - * - * This may be set to 0, resulting in an alpha map with all pixels white. */ - iGrayscaleBits = -1; - - /* If true and color precision is being lost, dither. (slow) */ - bDither = false; - /* If true, resize the image to fill the internal texture. (slow) */ - bStretch = false; - - /* Preferred color depth of the image. (This is overridden for - * paletted images and transparencies.) */ - iColorDepth = -1; /* default */ - - /* If true, enable HOT PINK color keying. (deprecated but needed for - * banners) */ - bHotPinkColorKey = false; - - /* These hints will be used in addition to any in the filename. */ - AdditionalTextureHints = ""; -} - -bool RageTextureID::operator<(const RageTextureID &rhs) const -{ -#define COMP(a) if(arhs.a) return false; - COMP(filename); - COMP(iMaxSize); - COMP(iMipMaps); - COMP(iAlphaBits); - COMP(iGrayscaleBits); - COMP(iColorDepth); - COMP(bDither); - COMP(bStretch); - COMP(bHotPinkColorKey); - COMP(AdditionalTextureHints); -#undef COMP - return false; -} - -bool RageTextureID::operator==(const RageTextureID &rhs) const -{ -#define EQUAL(a) (a==rhs.a) - return - EQUAL(filename) && - EQUAL(iMaxSize) && - EQUAL(iMipMaps) && - EQUAL(iAlphaBits) && - EQUAL(iGrayscaleBits) && - EQUAL(iColorDepth) && - EQUAL(bDither) && - EQUAL(bStretch) && - EQUAL(bHotPinkColorKey) && - EQUAL(AdditionalTextureHints); -} - RageTexture::RageTexture( RageTextureID name ): m_ID(name) diff --git a/stepmania/src/RageTexture.h b/stepmania/src/RageTexture.h index 53ac700a68..51857ee1b6 100644 --- a/stepmania/src/RageTexture.h +++ b/stepmania/src/RageTexture.h @@ -13,34 +13,9 @@ #include "RageTypes.h" +#include "RageTextureID.h" -/* A unique texture is identified by a RageTextureID. (Loading the - * same file with two different dither settings is considered two - * different textures, for example.) See RageTexture.cpp for explanations - * of these. */ -struct RageTextureID -{ - CString filename; - int iMaxSize; - int iMipMaps; - int iAlphaBits; - int iGrayscaleBits; - int iColorDepth; - bool bDither; - bool bStretch; - bool bHotPinkColorKey; /* #FF00FF */ - CString AdditionalTextureHints; - - bool operator< (const RageTextureID &rhs) const; - bool operator== (const RageTextureID &rhs) const; - - void Init(); - - RageTextureID() { Init(); } - RageTextureID(const CString &fn) { Init(); filename=fn; } -}; - //----------------------------------------------------------------------------- // RageTexture Class Declarations //----------------------------------------------------------------------------- diff --git a/stepmania/src/RageTextureID.cpp b/stepmania/src/RageTextureID.cpp new file mode 100644 index 0000000000..e79f352097 --- /dev/null +++ b/stepmania/src/RageTextureID.cpp @@ -0,0 +1,75 @@ +#include "global.h" +#include "RageTextureID.h" + +void RageTextureID::Init() +{ + /* Maximum size of the texture, per dimension. */ + iMaxSize = 2048; + + /* Number of mipmaps. (unimplemented) */ + iMipMaps = 4; + + /* Maximum number of bits for alpha. In 16-bit modes, lowering + * this gives more bits for color values. (0, 1 or 4) */ + iAlphaBits = 4; + + /* If this is greater than -1, then the image will be loaded as a luma/alpha + * map, eg. I4A4. At most 8 bits per pixel will be used This only actually happens + * when paletted textures are supported. + * + * If the sum of alpha and grayscale bits is <= 4, and the system supports 4-bit + * palettes, then the image will be loaded with 4bpp. + * + * This may be set to 0, resulting in an alpha map with all pixels white. */ + iGrayscaleBits = -1; + + /* If true and color precision is being lost, dither. (slow) */ + bDither = false; + /* If true, resize the image to fill the internal texture. (slow) */ + bStretch = false; + + /* Preferred color depth of the image. (This is overridden for + * paletted images and transparencies.) */ + iColorDepth = -1; /* default */ + + /* If true, enable HOT PINK color keying. (deprecated but needed for + * banners) */ + bHotPinkColorKey = false; + + /* These hints will be used in addition to any in the filename. */ + AdditionalTextureHints = ""; +} + +bool RageTextureID::operator<(const RageTextureID &rhs) const +{ +#define COMP(a) if(arhs.a) return false; + COMP(filename); + COMP(iMaxSize); + COMP(iMipMaps); + COMP(iAlphaBits); + COMP(iGrayscaleBits); + COMP(iColorDepth); + COMP(bDither); + COMP(bStretch); + COMP(bHotPinkColorKey); + COMP(AdditionalTextureHints); +#undef COMP + return false; +} + +bool RageTextureID::operator==(const RageTextureID &rhs) const +{ +#define EQUAL(a) (a==rhs.a) + return + EQUAL(filename) && + EQUAL(iMaxSize) && + EQUAL(iMipMaps) && + EQUAL(iAlphaBits) && + EQUAL(iGrayscaleBits) && + EQUAL(iColorDepth) && + EQUAL(bDither) && + EQUAL(bStretch) && + EQUAL(bHotPinkColorKey) && + EQUAL(AdditionalTextureHints); +} + diff --git a/stepmania/src/RageTextureID.h b/stepmania/src/RageTextureID.h new file mode 100644 index 0000000000..a4c5f03370 --- /dev/null +++ b/stepmania/src/RageTextureID.h @@ -0,0 +1,30 @@ +#ifndef RAGE_TEXTURE_ID_H +#define RAGE_TEXTURE_ID_H + +/* A unique texture is identified by a RageTextureID. (Loading the + * same file with two different dither settings is considered two + * different textures, for example.) See RageTexture.cpp for explanations + * of these. */ +struct RageTextureID +{ + CString filename; + int iMaxSize; + int iMipMaps; + int iAlphaBits; + int iGrayscaleBits; + int iColorDepth; + bool bDither; + bool bStretch; + bool bHotPinkColorKey; /* #FF00FF */ + CString AdditionalTextureHints; + + bool operator< (const RageTextureID &rhs) const; + bool operator== (const RageTextureID &rhs) const; + + void Init(); + + RageTextureID() { Init(); } + RageTextureID(const CString &fn) { Init(); filename=fn; } +}; + +#endif diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index c058a6d891..0ca809a2e5 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -1,5 +1,5 @@ # Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 60000 +# Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Application" 0x0101 @@ -62,10 +62,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # Begin Special Build Tool IntDir=.\../Debug6 -TargetDir=\stepmania\stepmania +TargetDir=\temp\stepmania TargetName=StepMania-debug SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -82,28 +82,24 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania # PROP Intermediate_Dir "Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c -# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /D "OGG_ONLY" /YX /FD /G6 /Ztmp /c -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP -# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP -XBE=imagebld.exe -# ADD BASE XBE /nologo /stack:0x10000 /debug -# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe" XBCP=xbecopy.exe # ADD BASE XBCP /NOLOGO # ADD XBCP /NOLOGO +XBE=imagebld.exe +# ADD BASE XBE /nologo /stack:0x10000 /debug +# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe" +LINK32=link.exe +# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP +# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +CPP=cl.exe +# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c +# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /D "OGG_ONLY" /YX /FD /G6 /Ztmp /c # Begin Special Build Tool -IntDir=.\Debug -TargetDir=\stepmania\stepmania -TargetName=default -SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ - /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ + /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -140,10 +136,10 @@ LINK32=link.exe # SUBTRACT LINK32 /verbose /pdb:none # Begin Special Build Tool IntDir=.\../Release6 -TargetDir=\stepmania\stepmania +TargetDir=\temp\stepmania TargetName=StepMania SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi # End Special Build Tool @@ -161,31 +157,27 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania # PROP Intermediate_Dir "StepMania___Xbox_Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c -# SUBTRACT CPP /Fr -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo +XBCP=xbecopy.exe +# ADD BASE XBCP /NOLOGO +# ADD XBCP /NOLOGO +XBE=imagebld.exe +# ADD BASE XBE /nologo /stack:0x10000 /debug +# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe" LINK32=link.exe # ADD BASE LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe" # SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib # ADD LINK32 $(intdir)\verstub.obj xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xnet.lib xboxkrnl.lib libcmt.lib /nologo /incremental:no /pdb:"../release6xbox/StepMania.pdb" /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"../StepManiaXbox.exe" /subsystem:xbox /fixed:no /TMP /OPT:REF # SUBTRACT LINK32 /pdb:none /map /debug -XBE=imagebld.exe -# ADD BASE XBE /nologo /stack:0x10000 /debug -# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe" -XBCP=xbecopy.exe -# ADD BASE XBCP /NOLOGO -# ADD XBCP /NOLOGO +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +CPP=cl.exe +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c +# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c +# SUBTRACT CPP /Fr # Begin Special Build Tool -IntDir=.\StepMania___Xbox_Release -TargetDir=\stepmania\stepmania -TargetName=default -SOURCE="$(InputPath)" -PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ - /Fo$(IntDir)\ +PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \ + /Fo$(IntDir)\ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi # End Special Build Tool @@ -804,6 +796,25 @@ SOURCE=.\RageTexture.h # End Source File # Begin Source File +SOURCE=.\RageTextureID.cpp + +!IF "$(CFG)" == "StepMania - Win32 Debug" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Debug" + +!ELSEIF "$(CFG)" == "StepMania - Win32 Release" + +!ELSEIF "$(CFG)" == "StepMania - Xbox Release" + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=.\RageTextureID.h +# End Source File +# Begin Source File + SOURCE=.\RageTextureManager.cpp !IF "$(CFG)" == "StepMania - Win32 Debug" diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 438de85034..46a5aae861 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -1612,6 +1612,12 @@ cl /Zl /nologo /c verstub.cpp /Fo"$(IntDir)"\ + + + +